You are here

protected function ManyToOne::opHelper in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/filter/ManyToOne.php \Drupal\views\Plugin\views\filter\ManyToOne::opHelper()
  2. 9 core/modules/views/src/Plugin/views/filter/ManyToOne.php \Drupal\views\Plugin\views\filter\ManyToOne::opHelper()

File

core/modules/views/src/Plugin/views/filter/ManyToOne.php, line 129

Class

ManyToOne
Complex filter to handle filtering for many to one relationships, such as terms (many terms per node) or roles (many roles per user).

Namespace

Drupal\views\Plugin\views\filter

Code

protected function opHelper() {
  if (empty($this->value)) {
    return;
  }

  // Form API returns unchecked options in the form of option_id => 0. This
  // breaks the generated query for "is all of" filters so we remove them.
  $this->value = array_filter($this->value, [
    static::class,
    'arrayFilterZero',
  ]);
  $this->helper
    ->addFilter();
}