Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/modules/node/views_handler_field_node_link.inc | ||
---|---|---|
12 | 12 |
*/ |
13 | 13 |
class views_handler_field_node_link extends views_handler_field_entity { |
14 | 14 |
|
15 |
function option_definition() { |
|
15 |
/** |
|
16 |
* {@inheritdoc} |
|
17 |
*/ |
|
18 |
public function option_definition() { |
|
16 | 19 |
$options = parent::option_definition(); |
17 | 20 |
$options['text'] = array('default' => '', 'translatable' => TRUE); |
18 | 21 |
return $options; |
19 | 22 |
} |
20 | 23 |
|
21 |
function options_form(&$form, &$form_state) { |
|
24 |
/** |
|
25 |
* {@inheritdoc} |
|
26 |
*/ |
|
27 |
public function options_form(&$form, &$form_state) { |
|
22 | 28 |
$form['text'] = array( |
23 | 29 |
'#type' => 'textfield', |
24 | 30 |
'#title' => t('Text to display'), |
... | ... | |
31 | 37 |
$form['alter']['external'] = array('#access' => FALSE); |
32 | 38 |
} |
33 | 39 |
|
34 |
function render($values) { |
|
40 |
/** |
|
41 |
* {@inheritdoc} |
|
42 |
*/ |
|
43 |
public function render($values) { |
|
35 | 44 |
if ($entity = $this->get_value($values)) { |
36 | 45 |
return $this->render_link($entity, $values); |
37 | 46 |
} |
38 | 47 |
} |
39 | 48 |
|
40 |
function render_link($node, $values) { |
|
49 |
/** |
|
50 |
* {@inheritdoc} |
|
51 |
*/ |
|
52 |
public function render_link($node, $values) { |
|
41 | 53 |
if (node_access('view', $node)) { |
42 | 54 |
$this->options['alter']['make_link'] = TRUE; |
43 | 55 |
$this->options['alter']['path'] = "node/$node->nid"; |
... | ... | |
45 | 57 |
return $text; |
46 | 58 |
} |
47 | 59 |
} |
60 |
|
|
48 | 61 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules