commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-old / views / modules / field / views_handler_filter_field_list_boolean.inc
1 <?php
2
3 /**
4 * @file
5 * Definition of views_handler_filter_field_list_boolean.
6 */
7
8 /**
9 * Filter handler for boolean fields.
10 *
11 * @ingroup views_filter_handlers
12 */
13 class views_handler_filter_field_list_boolean extends views_handler_filter_field_list {
14
15 function get_value_options() {
16 $field = field_info_field($this->definition['field_name']);
17 $value_options = list_allowed_values($field);
18
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');
29 }
30
31 $this->value_options = $value_options;
32 }
33 }