You are here

public function views_handler_filter_term_node_tid::accept_exposed_input in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 6.3 modules/taxonomy/views_handler_filter_term_node_tid.inc \views_handler_filter_term_node_tid::accept_exposed_input()
  2. 6.2 modules/taxonomy/views_handler_filter_term_node_tid.inc \views_handler_filter_term_node_tid::accept_exposed_input()

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

Overrides views_handler_filter_in_operator::accept_exposed_input

File

modules/taxonomy/views_handler_filter_term_node_tid.inc, line 278
Definition of views_handler_filter_term_node_tid.

Class

views_handler_filter_term_node_tid
Filter by term id.

Code

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

  // We need to know the operator, which is normally set in
  // views_handler_filter::accept_exposed_input(), before we actually call
  // the parent version of ourselves.
  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 view is an attachment and is inheriting exposed filters, then assume
  // exposed input has already been validated
  if (!empty($this->view->is_attachment) && $this->view->display_handler
    ->uses_exposed()) {
    $this->validated_exposed_input = (array) $this->view->exposed_raw_input[$this->options['expose']['identifier']];
  }

  // If we're checking for EMPTY or NOT, we don't need any input, and we can
  // say that our input conditions are met by just having the right operator.
  if ($this->operator == 'empty' || $this->operator == 'not empty') {
    return TRUE;
  }

  // If it's non-required and there's no value don't bother filtering.
  if (!$this->options['expose']['required'] && empty($this->validated_exposed_input)) {
    return FALSE;
  }
  $rc = parent::accept_exposed_input($input);
  if ($rc) {

    // If we have previously validated input, override.
    if (!$this
      ->is_a_group() && isset($this->validated_exposed_input)) {
      $this->value = $this->validated_exposed_input;
    }
  }
  return $rc;
}