Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/handlers/views_handler_field_serialized.inc | ||
---|---|---|
12 | 12 |
*/ |
13 | 13 |
class views_handler_field_serialized extends views_handler_field { |
14 | 14 |
|
15 |
function option_definition() { |
|
15 |
/** |
|
16 |
* {@inheritdoc} |
|
17 |
*/ |
|
18 |
public function option_definition() { |
|
16 | 19 |
$options = parent::option_definition(); |
17 | 20 |
$options['format'] = array('default' => 'unserialized'); |
18 | 21 |
$options['key'] = array('default' => ''); |
19 | 22 |
return $options; |
20 | 23 |
} |
21 | 24 |
|
22 |
|
|
23 |
function options_form(&$form, &$form_state) { |
|
25 |
/** |
|
26 |
* {@inheritdoc} |
|
27 |
*/ |
|
28 |
public function options_form(&$form, &$form_state) { |
|
24 | 29 |
parent::options_form($form, $form_state); |
25 | 30 |
|
26 | 31 |
$form['format'] = array( |
... | ... | |
42 | 47 |
); |
43 | 48 |
} |
44 | 49 |
|
45 |
function options_validate(&$form, &$form_state) { |
|
50 |
/** |
|
51 |
* {@inheritdoc} |
|
52 |
*/ |
|
53 |
public function options_validate(&$form, &$form_state) { |
|
46 | 54 |
// Require a key if the format is key. |
47 | 55 |
if ($form_state['values']['options']['format'] == 'key' && $form_state['values']['options']['key'] == '') { |
48 | 56 |
form_error($form['key'], t('You have to enter a key if you want to display a key of the data.')); |
49 | 57 |
} |
50 | 58 |
} |
51 | 59 |
|
52 |
function render($values) { |
|
60 |
/** |
|
61 |
* {@inheritdoc} |
|
62 |
*/ |
|
63 |
public function render($values) { |
|
53 | 64 |
$value = $values->{$this->field_alias}; |
54 | 65 |
|
55 | 66 |
if ($this->options['format'] == 'unserialized') { |
... | ... | |
62 | 73 |
|
63 | 74 |
return $value; |
64 | 75 |
} |
76 |
|
|
65 | 77 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules