Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/handlers/views_handler_field_url.inc | ||
---|---|---|
6 | 6 |
*/ |
7 | 7 |
|
8 | 8 |
/** |
9 |
* Field handler to provide simple renderer that turns a URL into a clickable link.
|
|
9 |
* Field handler that turns a URL into a clickable link. |
|
10 | 10 |
* |
11 | 11 |
* @ingroup views_field_handlers |
12 | 12 |
*/ |
13 | 13 |
class views_handler_field_url extends views_handler_field { |
14 |
function option_definition() { |
|
14 |
|
|
15 |
/** |
|
16 |
* {@inheritdoc} |
|
17 |
*/ |
|
18 |
public function option_definition() { |
|
15 | 19 |
$options = parent::option_definition(); |
16 | 20 |
|
17 | 21 |
$options['display_as_link'] = array('default' => TRUE, 'bool' => TRUE); |
... | ... | |
22 | 26 |
/** |
23 | 27 |
* Provide link to the page being visited. |
24 | 28 |
*/ |
25 |
function options_form(&$form, &$form_state) { |
|
29 |
public function options_form(&$form, &$form_state) {
|
|
26 | 30 |
$form['display_as_link'] = array( |
27 | 31 |
'#title' => t('Display as link'), |
28 | 32 |
'#type' => 'checkbox', |
... | ... | |
31 | 35 |
parent::options_form($form, $form_state); |
32 | 36 |
} |
33 | 37 |
|
34 |
function render($values) { |
|
38 |
/** |
|
39 |
* {@inheritdoc} |
|
40 |
*/ |
|
41 |
public function render($values) { |
|
35 | 42 |
$value = $this->get_value($values); |
36 | 43 |
if (!empty($this->options['display_as_link'])) { |
37 | 44 |
$this->options['alter']['make_link'] = TRUE; |
... | ... | |
43 | 50 |
return $this->sanitize_value($value, 'url'); |
44 | 51 |
} |
45 | 52 |
} |
53 |
|
|
46 | 54 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules