Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/handlers/views_handler_field_numeric.inc | ||
---|---|---|
6 | 6 |
*/ |
7 | 7 |
|
8 | 8 |
/** |
9 |
* Render a field as a numeric value |
|
9 |
* Render a field as a numeric value.
|
|
10 | 10 |
* |
11 | 11 |
* Definition terms: |
12 | 12 |
* - float: If true this field contains a decimal value. If unset this field |
13 |
* will be assumed to be integer.
|
|
13 |
* will be assumed to be integer. |
|
14 | 14 |
* |
15 | 15 |
* @ingroup views_field_handlers |
16 | 16 |
*/ |
17 | 17 |
class views_handler_field_numeric extends views_handler_field { |
18 |
function option_definition() { |
|
18 |
|
|
19 |
/** |
|
20 |
* {@inheritdoc} |
|
21 |
*/ |
|
22 |
public function option_definition() { |
|
19 | 23 |
$options = parent::option_definition(); |
20 | 24 |
|
21 | 25 |
$options['set_precision'] = array('default' => FALSE, 'bool' => TRUE); |
... | ... | |
31 | 35 |
return $options; |
32 | 36 |
} |
33 | 37 |
|
34 |
function options_form(&$form, &$form_state) { |
|
38 |
/** |
|
39 |
* {@inheritdoc} |
|
40 |
*/ |
|
41 |
public function options_form(&$form, &$form_state) { |
|
35 | 42 |
if (!empty($this->definition['float'])) { |
36 | 43 |
$form['set_precision'] = array( |
37 | 44 |
'#type' => 'checkbox', |
... | ... | |
105 | 112 |
parent::options_form($form, $form_state); |
106 | 113 |
} |
107 | 114 |
|
108 |
function render($values) { |
|
115 |
/** |
|
116 |
* {@inheritdoc} |
|
117 |
*/ |
|
118 |
public function render($values) { |
|
109 | 119 |
$value = $this->get_value($values); |
110 | 120 |
|
111 | 121 |
// Hiding should happen before rounding or adding prefix/suffix. |
... | ... | |
135 | 145 |
. $this->sanitize_value($value) |
136 | 146 |
. $this->sanitize_value($this->options['suffix'], 'xss'); |
137 | 147 |
} |
148 |
|
|
138 | 149 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules