You are here

function weight_handler_filter_weight_enabled::value_form in Weight 7.2

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()

1 call to weight_handler_filter_weight_enabled::value_form()
weight_handler_filter_weight_enabled::show_value_form in views/weight_handler_filter_weight_enabled.inc
Shortcut to display the value form.

File

views/weight_handler_filter_weight_enabled.inc, line 4

Class

weight_handler_filter_weight_enabled

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' => t('Enabled'),
    '#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;
    }
  }
}