1 views_handler_filter_boolean_operator.inc views_handler_filter_boolean_operator::value_form(&$form, &$form_state)

Options form subform for setting options.

This should be overridden by all child classes and it must define $form['value']

Overrides views_handler_filter::value_form

See also

options_form()

File

core/modules/views/handlers/views_handler_filter_boolean_operator.inc, line 93
Definition of views_handler_filter_boolean_operator.

Class

views_handler_filter_boolean_operator
Simple filter to handle matching of boolean values

Code

function value_form(&$form, &$form_state) {
  if (empty($this->value_options)) {
    // Initialize the array of possible values for this filter.
    $this->get_value_options();
  }
  if (!empty($form_state['exposed'])) {
    // Exposed filter: use a select box to save space.
    $filter_form_type = 'select';
  }
  else {
    // Configuring a filter: use radios for clarity.
    $filter_form_type = 'radios';
  }
  $form['value'] = array(
    '#type' => $filter_form_type,
    '#title' => $this->value_value,
    '#options' => $this->value_options,
    '#default_value' => $this->value,
  );
  if (!empty($this->options['exposed'])) {
    $identifier = $this->options['expose']['identifier'];
    if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) {
      $form_state['input'][$identifier] = $this->value;
    }
    // If we're configuring an exposed filter, add an <Any> option.
    if (empty($form_state['exposed']) || empty($this->options['expose']['required'])) {
      $any_label = config_get('views.settings', 'exposed_filter_any_label') == 'old_any' ? '<Any>' : t('- Any -');
      if ($form['value']['#type'] != 'select') {
        $any_label = check_plain($any_label);
      }
      $form['value']['#options'] = array('All' => $any_label) + $form['value']['#options'];
    }
  }
}