Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/modules/comment/views_handler_field_comment_username.inc | ||
---|---|---|
11 | 11 |
* @ingroup views_field_handlers |
12 | 12 |
*/ |
13 | 13 |
class views_handler_field_comment_username extends views_handler_field { |
14 |
|
|
14 | 15 |
/** |
15 | 16 |
* Override init function to add uid and homepage fields. |
16 | 17 |
*/ |
17 |
function init(&$view, &$data) { |
|
18 |
public function init(&$view, &$data) {
|
|
18 | 19 |
parent::init($view, $data); |
19 | 20 |
$this->additional_fields['uid'] = 'uid'; |
20 | 21 |
$this->additional_fields['homepage'] = 'homepage'; |
21 | 22 |
} |
22 | 23 |
|
23 |
function option_definition() { |
|
24 |
/** |
|
25 |
* {@inheritdoc} |
|
26 |
*/ |
|
27 |
public function option_definition() { |
|
24 | 28 |
$options = parent::option_definition(); |
25 | 29 |
$options['link_to_user'] = array('default' => TRUE, 'bool' => TRUE); |
26 | 30 |
return $options; |
27 | 31 |
} |
28 | 32 |
|
29 |
function options_form(&$form, &$form_state) { |
|
33 |
/** |
|
34 |
* {@inheritdoc} |
|
35 |
*/ |
|
36 |
public function options_form(&$form, &$form_state) { |
|
30 | 37 |
$form['link_to_user'] = array( |
31 | 38 |
'#title' => t("Link this field to its user or an author's homepage"), |
32 | 39 |
'#type' => 'checkbox', |
... | ... | |
35 | 42 |
parent::options_form($form, $form_state); |
36 | 43 |
} |
37 | 44 |
|
38 |
function render_link($data, $values) { |
|
45 |
/** |
|
46 |
* {@inheritdoc} |
|
47 |
*/ |
|
48 |
public function render_link($data, $values) { |
|
39 | 49 |
if (!empty($this->options['link_to_user'])) { |
40 | 50 |
$account = new stdClass(); |
41 | 51 |
$account->uid = $this->get_value($values, 'uid'); |
... | ... | |
51 | 61 |
} |
52 | 62 |
} |
53 | 63 |
|
54 |
function render($values) { |
|
64 |
/** |
|
65 |
* {@inheritdoc} |
|
66 |
*/ |
|
67 |
public function render($values) { |
|
55 | 68 |
$value = $this->get_value($values); |
56 | 69 |
return $this->render_link($this->sanitize_value($value), $values); |
57 | 70 |
} |
71 |
|
|
58 | 72 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules