function InOperator::operators

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/filter/InOperator.php \Drupal\views\Plugin\views\filter\InOperator::operators()
  2. 8.9.x core/modules/views/src/Plugin/views/filter/InOperator.php \Drupal\views\Plugin\views\filter\InOperator::operators()
  3. 10 core/modules/views/src/Plugin/views/filter/InOperator.php \Drupal\views\Plugin\views\filter\InOperator::operators()

Returns an array of operator information, keyed by operator ID.

Return value

array[] An array of operator information, keyed by operator ID.

Overrides FilterOperatorsInterface::operators

4 calls to InOperator::operators()
InOperator::adminSummary in core/modules/views/src/Plugin/views/filter/InOperator.php
InOperator::operatorOptions in core/modules/views/src/Plugin/views/filter/InOperator.php
Build strings from the operators() for 'select' options.
InOperator::operatorValues in core/modules/views/src/Plugin/views/filter/InOperator.php
Gets the operators that have a given number of values.
InOperator::query in core/modules/views/src/Plugin/views/filter/InOperator.php
1 method overrides InOperator::operators()
ManyToOne::operators in core/modules/views/src/Plugin/views/filter/ManyToOne.php

File

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

Class

InOperator
Filter to handle matching of multiple options selectable via checkboxes.

Namespace

Drupal\views\Plugin\views\filter

Code

public function operators() {
  $operators = [
    'in' => [
      'title' => $this->t('Is one of'),
      'short' => $this->t('in'),
      'short_single' => $this->t('='),
      'method' => 'opSimple',
      'values' => 1,
    ],
    'not in' => [
      'title' => $this->t('Is not one of'),
      'short' => $this->t('not in'),
      'short_single' => $this->t('<>'),
      'method' => 'opSimple',
      'values' => 1,
    ],
  ];
  // If the definition allows for the empty operator, add it.
  if (!empty($this->definition['allow empty'])) {
    $operators += [
      'empty' => [
        'title' => $this->t('Is empty (NULL)'),
        'method' => 'opEmpty',
        'short' => $this->t('empty'),
        'values' => 0,
      ],
      'not empty' => [
        'title' => $this->t('Is not empty (NOT NULL)'),
        'method' => 'opEmpty',
        'short' => $this->t('not empty'),
        'values' => 0,
      ],
    ];
  }
  return $operators;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.