You are here

public function SearchApiViewsHandlerFilterText::accept_exposed_input in Search API 7

Determines whether input from the exposed filters affects this filter.

Overridden to not treat "All" differently.

Parameters

array $input: The user input from the exposed filters.

Return value

bool TRUE if the input should change the behavior of this filter.

Overrides views_handler_filter::accept_exposed_input

File

contrib/search_api_views/includes/handler_filter_text.inc, line 31
Contains SearchApiViewsHandlerFilterText.

Class

SearchApiViewsHandlerFilterText
Views filter handler class for handling fulltext fields.

Code

public 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 (!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;
}