Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/modules/aggregator/views_handler_field_aggregator_category.inc | ||
---|---|---|
12 | 12 |
* @ingroup views_field_handlers |
13 | 13 |
*/ |
14 | 14 |
class views_handler_field_aggregator_category extends views_handler_field { |
15 |
|
|
15 | 16 |
/** |
16 | 17 |
* Constructor to provide additional field to add. |
17 | 18 |
*/ |
18 |
function construct() { |
|
19 |
public function construct() {
|
|
19 | 20 |
parent::construct(); |
20 | 21 |
$this->additional_fields['cid'] = 'cid'; |
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_category'] = array('default' => FALSE, 'bool' => TRUE); |
26 | 30 |
return $options; |
... | ... | |
29 | 33 |
/** |
30 | 34 |
* Provide link to category option |
31 | 35 |
*/ |
32 |
function options_form(&$form, &$form_state) { |
|
36 |
public function options_form(&$form, &$form_state) {
|
|
33 | 37 |
$form['link_to_category'] = array( |
34 | 38 |
'#title' => t('Link this field to its aggregator category page'), |
35 | 39 |
'#description' => t('This will override any other link you have set.'), |
... | ... | |
44 | 48 |
* |
45 | 49 |
* Data should be made XSS safe prior to calling this function. |
46 | 50 |
*/ |
47 |
function render_link($data, $values) { |
|
51 |
public function render_link($data, $values) {
|
|
48 | 52 |
$cid = $this->get_value($values, 'cid'); |
49 | 53 |
if (!empty($this->options['link_to_category']) && !empty($cid) && $data !== NULL && $data !== '') { |
50 | 54 |
$this->options['alter']['make_link'] = TRUE; |
... | ... | |
53 | 57 |
return $data; |
54 | 58 |
} |
55 | 59 |
|
56 |
function render($values) { |
|
60 |
/** |
|
61 |
* {@inheritdoc} |
|
62 |
*/ |
|
63 |
public function render($values) { |
|
57 | 64 |
$value = $this->get_value($values); |
58 | 65 |
return $this->render_link($this->sanitize_value($value), $values); |
59 | 66 |
} |
67 |
|
|
60 | 68 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules