Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/modules/field/views_handler_argument_field_list_string.inc | ||
---|---|---|
2 | 2 |
|
3 | 3 |
/** |
4 | 4 |
* @file |
5 |
* Definition of views_handler_argument_field_list_text.
|
|
5 |
* Definition of views_handler_argument_field_list_string.
|
|
6 | 6 |
*/ |
7 | 7 |
|
8 | 8 |
/** |
... | ... | |
12 | 12 |
* @ingroup views_argument_handlers |
13 | 13 |
*/ |
14 | 14 |
class views_handler_argument_field_list_string extends views_handler_argument_string { |
15 |
|
|
15 | 16 |
/** |
16 | 17 |
* Stores the allowed values of this field. |
17 | 18 |
* |
18 | 19 |
* @var array |
19 | 20 |
*/ |
20 |
var $allowed_values = NULL;
|
|
21 |
public $allowed_values = NULL;
|
|
21 | 22 |
|
22 |
function init(&$view, &$options) { |
|
23 |
/** |
|
24 |
* {@inheritdoc} |
|
25 |
*/ |
|
26 |
public function init(&$view, &$options) { |
|
23 | 27 |
parent::init($view, $options); |
24 | 28 |
$field = field_info_field($this->definition['field_name']); |
25 | 29 |
$this->allowed_values = list_allowed_values($field); |
26 | 30 |
} |
27 | 31 |
|
28 |
function option_definition() { |
|
32 |
/** |
|
33 |
* {@inheritdoc} |
|
34 |
*/ |
|
35 |
public function option_definition() { |
|
29 | 36 |
$options = parent::option_definition(); |
30 | 37 |
|
31 | 38 |
$options['summary']['contains']['human'] = array('default' => FALSE, 'bool' => TRUE); |
... | ... | |
33 | 40 |
return $options; |
34 | 41 |
} |
35 | 42 |
|
36 |
function options_form(&$form, &$form_state) { |
|
43 |
/** |
|
44 |
* {@inheritdoc} |
|
45 |
*/ |
|
46 |
public function options_form(&$form, &$form_state) { |
|
37 | 47 |
parent::options_form($form, $form_state); |
38 | 48 |
|
39 | 49 |
$form['summary']['human'] = array( |
... | ... | |
44 | 54 |
); |
45 | 55 |
} |
46 | 56 |
|
47 |
|
|
48 |
function summary_name($data) { |
|
57 |
/** |
|
58 |
* {@inheritdoc} |
|
59 |
*/ |
|
60 |
public function summary_name($data) { |
|
49 | 61 |
$value = $data->{$this->name_alias}; |
50 | 62 |
// If the list element has a human readable name show it, |
51 | 63 |
if (isset($this->allowed_values[$value]) && !empty($this->options['summary']['human'])) { |
52 | 64 |
return $this->case_transform(field_filter_xss($this->allowed_values[$value]), $this->options['case']); |
53 | 65 |
} |
54 |
// else fallback to the key.
|
|
66 |
// Else fallback to the key.
|
|
55 | 67 |
else { |
56 | 68 |
return $this->case_transform(check_plain($value), $this->options['case']); |
57 | 69 |
} |
58 | 70 |
} |
71 |
|
|
59 | 72 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules