Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/handlers/views_handler_field_math.inc | ||
---|---|---|
15 | 15 |
* @ingroup views_field_handlers |
16 | 16 |
*/ |
17 | 17 |
class views_handler_field_math extends views_handler_field_numeric { |
18 |
function option_definition() { |
|
18 |
|
|
19 |
/** |
|
20 |
* {@inheritdoc} |
|
21 |
*/ |
|
22 |
public function option_definition() { |
|
19 | 23 |
$options = parent::option_definition(); |
20 | 24 |
$options['expression'] = array('default' => ''); |
21 | 25 |
|
22 | 26 |
return $options; |
23 | 27 |
} |
24 | 28 |
|
25 |
function options_form(&$form, &$form_state) { |
|
29 |
/** |
|
30 |
* {@inheritdoc} |
|
31 |
*/ |
|
32 |
public function options_form(&$form, &$form_state) { |
|
26 | 33 |
$form['expression'] = array( |
27 | 34 |
'#type' => 'textarea', |
28 | 35 |
'#title' => t('Expression'), |
... | ... | |
30 | 37 |
'#default_value' => $this->options['expression'], |
31 | 38 |
); |
32 | 39 |
|
33 |
// Create a place for the help |
|
40 |
// Create a place for the help.
|
|
34 | 41 |
$form['expression_help'] = array(); |
35 | 42 |
parent::options_form($form, $form_state); |
36 | 43 |
|
37 |
// Then move the existing help:
|
|
44 |
// Then move the existing help.
|
|
38 | 45 |
$form['expression_help'] = $form['alter']['help']; |
39 | 46 |
unset($form['expression_help']['#dependency']); |
40 | 47 |
unset($form['alter']['help']); |
41 | 48 |
} |
42 | 49 |
|
43 |
function render($values) { |
|
50 |
/** |
|
51 |
* {@inheritdoc} |
|
52 |
*/ |
|
53 |
public function render($values) { |
|
44 | 54 |
ctools_include('math-expr'); |
45 | 55 |
$tokens = array_map('floatval', $this->get_render_tokens(array())); |
46 | 56 |
$value = strtr($this->options['expression'], $tokens); |
... | ... | |
80 | 90 |
return $this->sanitize_value($this->options['prefix'] . $value . $this->options['suffix']); |
81 | 91 |
} |
82 | 92 |
|
83 |
function query() { } |
|
93 |
/** |
|
94 |
* {@inheritdoc} |
|
95 |
*/ |
|
96 |
public function query() { |
|
97 |
} |
|
98 |
|
|
84 | 99 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules