Same name and namespace in other branches
  1. 8.9.x core/modules/views/src/Plugin/views/filter/InOperator.php \Drupal\views\Plugin\views\filter\InOperator::operators()
  2. 9 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[]

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
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
Returns an array of operator information, keyed by operator ID.

File

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

Class

InOperator

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;
}