You are here

public function Section::acceptExposedInput in Workbench Access 8

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

We change this default behavior, since our "Any" result should be filtered by the user's assignments.

Overrides InOperator::acceptExposedInput

File

src/Plugin/views/filter/Section.php, line 217

Class

Section
Filter by assigned section.

Namespace

Drupal\workbench_access\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 = ' ';
      }
    }

    // We removed two clauses here that cause the filter to be ignored.
    if (isset($value)) {
      $this->value = $value;
      if (empty($this->alwaysMultiple) && empty($this->options['expose']['multiple']) && !is_array($value)) {
        $this->value = [
          $value,
        ];
      }
    }
    else {
      return FALSE;
    }
  }
  return TRUE;
}