5 * Definition of views_handler_filter_field_list_boolean.
9 * Filter handler for boolean fields.
11 * @ingroup views_filter_handlers
13 class views_handler_filter_field_list_boolean extends views_handler_filter_field_list {
15 function get_value_options() {
16 $field = field_info_field($this->definition['field_name']);
17 $value_options = list_allowed_values($field);
19 // Boolean fields have an option for using the label as the 'on' value. This
20 // results in there being no label values in the allows values array.
21 // If this is the case, we need to provide the labels.
22 $filtered = array_filter($value_options);
23 if (empty($filtered)) {
24 // We can't provide the label in the same way the FieldAPI formatter does,
25 // as these are different on each instance, and we may be operating on
26 // more than one bundle.
27 $value_options[0] = t('Off');
28 $value_options[1] = t('On');
31 $this->value_options = $value_options;