Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/modules/user/views_handler_field_user_link.inc | ||
---|---|---|
11 | 11 |
* @ingroup views_field_handlers |
12 | 12 |
*/ |
13 | 13 |
class views_handler_field_user_link extends views_handler_field { |
14 |
function construct() { |
|
14 |
|
|
15 |
/** |
|
16 |
* {@inheritdoc} |
|
17 |
*/ |
|
18 |
public function construct() { |
|
15 | 19 |
parent::construct(); |
16 | 20 |
$this->additional_fields['uid'] = 'uid'; |
17 | 21 |
} |
18 | 22 |
|
19 |
function option_definition() { |
|
23 |
/** |
|
24 |
* {@inheritdoc} |
|
25 |
*/ |
|
26 |
public function option_definition() { |
|
20 | 27 |
$options = parent::option_definition(); |
21 | 28 |
$options['text'] = array('default' => '', 'translatable' => TRUE); |
22 | 29 |
return $options; |
23 | 30 |
} |
24 | 31 |
|
25 |
function options_form(&$form, &$form_state) { |
|
32 |
/** |
|
33 |
* {@inheritdoc} |
|
34 |
*/ |
|
35 |
public function options_form(&$form, &$form_state) { |
|
26 | 36 |
$form['text'] = array( |
27 | 37 |
'#type' => 'textfield', |
28 | 38 |
'#title' => t('Text to display'), |
... | ... | |
31 | 41 |
parent::options_form($form, $form_state); |
32 | 42 |
} |
33 | 43 |
|
34 |
// An example of field level access control. |
|
35 |
function access() { |
|
44 |
/** |
|
45 |
* An example of field level access control. |
|
46 |
*/ |
|
47 |
public function access() { |
|
36 | 48 |
return user_access('access user profiles'); |
37 | 49 |
} |
38 | 50 |
|
39 |
function query() { |
|
51 |
/** |
|
52 |
* {@inheritdoc} |
|
53 |
*/ |
|
54 |
public function query() { |
|
40 | 55 |
$this->ensure_my_table(); |
41 | 56 |
$this->add_additional_fields(); |
42 | 57 |
} |
43 | 58 |
|
44 |
function render($values) { |
|
59 |
/** |
|
60 |
* {@inheritdoc} |
|
61 |
*/ |
|
62 |
public function render($values) { |
|
45 | 63 |
$value = $this->get_value($values, 'uid'); |
46 | 64 |
return $this->render_link($this->sanitize_value($value), $values); |
47 | 65 |
} |
48 | 66 |
|
49 |
function render_link($data, $values) { |
|
67 |
/** |
|
68 |
* {@inheritdoc} |
|
69 |
*/ |
|
70 |
public function render_link($data, $values) { |
|
50 | 71 |
$text = !empty($this->options['text']) ? $this->options['text'] : t('view'); |
51 | 72 |
|
52 | 73 |
$this->options['alter']['make_link'] = TRUE; |
Formats disponibles : Unified diff
Weekly update of contrib modules