You are here

public function InOperator::acceptExposedInput in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/filter/InOperator.php \Drupal\views\Plugin\views\filter\InOperator::acceptExposedInput()

Determines if the input from a filter should change the generated query.

Parameters

array $input: The exposed data for this view.

Return value

bool TRUE if the input for this filter should be included in the view query. FALSE otherwise.

Overrides FilterPluginBase::acceptExposedInput

2 calls to InOperator::acceptExposedInput()
Name::acceptExposedInput in core/modules/user/src/Plugin/views/filter/Name.php
Determines if the input from a filter should change the generated query.
TaxonomyIndexTid::acceptExposedInput in core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
Determines if the input from a filter should change the generated query.
2 methods override InOperator::acceptExposedInput()
Name::acceptExposedInput in core/modules/user/src/Plugin/views/filter/Name.php
Determines if the input from a filter should change the generated query.
TaxonomyIndexTid::acceptExposedInput in core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
Determines if the input from a filter should change the generated query.

File

core/modules/views/src/Plugin/views/filter/InOperator.php, line 292

Class

InOperator
Simple filter to handle matching of multiple options selectable via checkboxes.

Namespace

Drupal\views\Plugin\views\filter

Code

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

  // The "All" state for this type of filter could have a default value. If
  // this is a non-multiple and non-required option, then this filter will
  // participate by using the default settings *if* 'limit' is true.
  if (empty($this->options['expose']['multiple']) && empty($this->options['expose']['required']) && !empty($this->options['expose']['limit'])) {
    $identifier = $this->options['expose']['identifier'];
    if ($input[$identifier] == 'All') {
      return TRUE;
    }
  }
  return parent::acceptExposedInput($input);
}