Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/modules/user/views_handler_field_user_name.inc | ||
---|---|---|
6 | 6 |
*/ |
7 | 7 |
|
8 | 8 |
/** |
9 |
* Field handler to provide simple renderer that allows using a themed user link.
|
|
9 |
* Field handler for a simple renderer that allows using a themed user link.
|
|
10 | 10 |
* |
11 | 11 |
* @ingroup views_field_handlers |
12 | 12 |
*/ |
13 | 13 |
class views_handler_field_user_name extends views_handler_field_user { |
14 |
|
|
14 | 15 |
/** |
15 | 16 |
* Add uid in the query so we can test for anonymous if needed. |
16 | 17 |
*/ |
17 |
function init(&$view, &$data) { |
|
18 |
public function init(&$view, &$data) {
|
|
18 | 19 |
parent::init($view, $data); |
19 | 20 |
if (!empty($this->options['overwrite_anonymous']) || !empty($this->options['format_username'])) { |
20 | 21 |
$this->additional_fields['uid'] = 'uid'; |
21 | 22 |
} |
22 | 23 |
} |
23 | 24 |
|
24 |
function option_definition() { |
|
25 |
/** |
|
26 |
* {@inheritdoc} |
|
27 |
*/ |
|
28 |
public function option_definition() { |
|
25 | 29 |
$options = parent::option_definition(); |
26 | 30 |
|
27 | 31 |
$options['overwrite_anonymous'] = array('default' => FALSE, 'bool' => TRUE); |
... | ... | |
31 | 35 |
return $options; |
32 | 36 |
} |
33 | 37 |
|
34 |
function options_form(&$form, &$form_state) { |
|
38 |
/** |
|
39 |
* {@inheritdoc} |
|
40 |
*/ |
|
41 |
public function options_form(&$form, &$form_state) { |
|
35 | 42 |
$form['format_username'] = array( |
36 | 43 |
'#title' => t('Use formatted username'), |
37 | 44 |
'#type' => 'checkbox', |
... | ... | |
59 | 66 |
parent::options_form($form, $form_state); |
60 | 67 |
} |
61 | 68 |
|
62 |
function render_link($data, $values) { |
|
69 |
/** |
|
70 |
* {@inheritdoc} |
|
71 |
*/ |
|
72 |
public function render_link($data, $values) { |
|
63 | 73 |
$account = new stdClass(); |
64 | 74 |
$account->uid = $this->get_value($values, 'uid'); |
65 | 75 |
$account->name = $this->get_value($values); |
... | ... | |
80 | 90 |
// Otherwise, there's no special handling, so return the data directly. |
81 | 91 |
return $data; |
82 | 92 |
} |
93 |
|
|
83 | 94 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules