You are here

public function FilterPluginBase::acceptExposedInput in Views (for Drupal 7) 8.3

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

Overrides HandlerBase::acceptExposedInput

2 calls to FilterPluginBase::acceptExposedInput()
InOperator::acceptExposedInput in lib/Drupal/views/Plugin/views/filter/InOperator.php
Check to see if input from the exposed filters should change the behavior of this filter.
Numeric::acceptExposedInput in lib/Drupal/views/Plugin/views/filter/Numeric.php
Do some minor translation of the exposed input
2 methods override FilterPluginBase::acceptExposedInput()
InOperator::acceptExposedInput in lib/Drupal/views/Plugin/views/filter/InOperator.php
Check to see if input from the exposed filters should change the behavior of this filter.
Numeric::acceptExposedInput in lib/Drupal/views/Plugin/views/filter/Numeric.php
Do some minor translation of the exposed input

File

lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php, line 1267
Definition of Drupal\views\Plugin\views\filter\FilterPluginBase.

Class

FilterPluginBase
Base class for filters.

Namespace

Drupal\views\Plugin\views\filter

Code

public function acceptExposedInput($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()) {
          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;
}