function InOperator::operators

Same name 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()

Overrides FilterOperatorsInterface::operators

4 calls to InOperator::operators()
InOperator::adminSummary in core/modules/views/src/Plugin/views/filter/InOperator.php
Display the filter on the administrative summary.
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
Add this filter to the query.
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
Simple 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.