1 views_handler_filter.inc views_handler_filter::accept_exposed_input($input)

Check to see if input from the exposed filters should change the behavior of this filter.

Overrides views_handler::accept_exposed_input

File

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

Class

views_handler_filter
Base class for filters.

Code

function accept_exposed_input($input) {
  if (empty($this->options['exposed'])) {
    return TRUE;
  }


  if (!empty($this->options['expose']['use_operator']) && !empty($this->options['expose']['operator_id']) && isset($input[$this->options['expose']['operator_id']])) {
    $this->operator = $input[$this->options['expose']['operator_id']];
  }

  if (!empty($this->options['expose']['identifier'])) {
    $value = $input[$this->options['expose']['identifier']];

    // Various ways to check for the absence of non-required input.
    if (empty($this->options['expose']['required'])) {
      if (($this->operator == 'empty' || $this->operator == 'not empty') && $value === '') {
        $value = ' ';
      }

      if ($this->operator != 'empty' && $this->operator != 'not empty') {
        if ($value === 'All' || $value === array() || $value === 0) {
          return FALSE;
        }
      }

      if (!empty($this->always_multiple) && $value === '') {
        return FALSE;
      }
    }


    if (isset($value)) {
      $this->value = $value;
      if (empty($this->always_multiple) && empty($this->options['expose']['multiple'])) {
        $this->value = array($value);
      }
    }
    else {
      return FALSE;
    }
  }

  return TRUE;
}