1 views_handler_filter.inc views_handler_filter::convert_exposed_input(&$input, $selected_group_id = NULL)

File

core/modules/views/handlers/views_handler_filter.inc, line 1180
@todo.

Class

views_handler_filter
Base class for filters.

Code

function convert_exposed_input(&$input, $selected_group_id = NULL) {
  if ($this->is_a_group()) {
    // If it is already defined the selected group, use it. Only valid
    // when the filter uses checkboxes for widget.
    if (!empty($selected_group_id)) {
      $selected_group = $selected_group_id;
    }
    else {
      $selected_group = $input[$this->options['group_info']['identifier']];
    }
    if ($selected_group == 'All' && !empty($this->options['group_info']['optional'])) {
      return NULL;
    }
    if ($selected_group != 'All' && empty($this->options['group_info']['group_items'][$selected_group])) {
      return FALSE;
    }
    if (isset($selected_group) && isset($this->options['group_info']['group_items'][$selected_group])) {
      $input[$this->options['expose']['operator']] = $this->options['group_info']['group_items'][$selected_group]['operator'];

      // Value can be optional, For example for 'empty' and 'not empty' filters.
      if (!empty($this->options['group_info']['group_items'][$selected_group]['value'])) {
        $input[$this->options['expose']['identifier']] = $this->options['group_info']['group_items'][$selected_group]['value'];
      }
      $this->options['expose']['use_operator'] = TRUE;

      $this->group_info = $input[$this->options['group_info']['identifier']];
      return TRUE;
    }
    else {
      return FALSE;
    }
  }
}