Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/modules/user/views_handler_field_user_roles.inc | ||
---|---|---|
11 | 11 |
* @ingroup views_field_handlers |
12 | 12 |
*/ |
13 | 13 |
class views_handler_field_user_roles extends views_handler_field_prerender_list { |
14 |
function construct() { |
|
14 |
|
|
15 |
/** |
|
16 |
* {@inheritdoc} |
|
17 |
*/ |
|
18 |
public function construct() { |
|
15 | 19 |
parent::construct(); |
16 | 20 |
$this->additional_fields['uid'] = array('table' => 'users', 'field' => 'uid'); |
17 | 21 |
} |
18 | 22 |
|
19 |
function query() { |
|
23 |
/** |
|
24 |
* {@inheritdoc} |
|
25 |
*/ |
|
26 |
public function query() { |
|
20 | 27 |
$this->add_additional_fields(); |
21 | 28 |
$this->field_alias = $this->aliases['uid']; |
22 | 29 |
} |
23 | 30 |
|
24 |
function pre_render(&$values) { |
|
31 |
/** |
|
32 |
* {@inheritdoc} |
|
33 |
*/ |
|
34 |
public function pre_render(&$values) { |
|
25 | 35 |
$uids = array(); |
26 | 36 |
$this->items = array(); |
27 | 37 |
|
... | ... | |
39 | 49 |
} |
40 | 50 |
} |
41 | 51 |
|
42 |
function render_item($count, $item) { |
|
52 |
/** |
|
53 |
* {@inheritdoc} |
|
54 |
*/ |
|
55 |
public function render_item($count, $item) { |
|
43 | 56 |
return $item['role']; |
44 | 57 |
} |
45 | 58 |
|
46 |
function document_self_tokens(&$tokens) { |
|
59 |
/** |
|
60 |
* {@inheritdoc} |
|
61 |
*/ |
|
62 |
public function document_self_tokens(&$tokens) { |
|
47 | 63 |
$tokens['[' . $this->options['id'] . '-role' . ']'] = t('The name of the role.'); |
48 | 64 |
$tokens['[' . $this->options['id'] . '-rid' . ']'] = t('The role ID of the role.'); |
49 | 65 |
} |
50 | 66 |
|
51 |
function add_self_tokens(&$tokens, $item) { |
|
67 |
/** |
|
68 |
* {@inheritdoc} |
|
69 |
*/ |
|
70 |
public function add_self_tokens(&$tokens, $item) { |
|
52 | 71 |
if (!empty($item['role'])) { |
53 | 72 |
$tokens['[' . $this->options['id'] . '-role' . ']'] = $item['role']; |
54 | 73 |
$tokens['[' . $this->options['id'] . '-rid' . ']'] = $item['rid']; |
55 | 74 |
} |
56 | 75 |
} |
76 |
|
|
57 | 77 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules