function NumericFilter::operators

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

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

Return value

array[]

Overrides FilterOperatorsInterface::operators

9 calls to NumericFilter::operators()
Date::acceptExposedInput in core/modules/views/src/Plugin/views/filter/Date.php
Do some minor translation of the exposed input.
Date::hasValidGroupedValue in core/modules/views/src/Plugin/views/filter/Date.php
Determines if the given grouped filter entry has a valid value.
Date::validateValidTime in core/modules/views/src/Plugin/views/filter/Date.php
Validate that the time values convert to something usable.
GroupByNumeric::query in core/modules/views/src/Plugin/views/filter/GroupByNumeric.php
Add this filter to the query.
NumericFilter::acceptExposedInput in core/modules/views/src/Plugin/views/filter/NumericFilter.php
Do some minor translation of the exposed input.

... See full list

File

core/modules/views/src/Plugin/views/filter/NumericFilter.php, line 95

Class

NumericFilter
Simple filter to handle greater than/less than filters.

Namespace

Drupal\views\Plugin\views\filter

Code

public function operators() {
  $operators = [
    '<' => [
      'title' => $this->t('Is less than'),
      'method' => 'opSimple',
      'short' => $this->t('<'),
      'values' => 1,
    ],
    '<=' => [
      'title' => $this->t('Is less than or equal to'),
      'method' => 'opSimple',
      'short' => $this->t('<='),
      'values' => 1,
    ],
    '=' => [
      'title' => $this->t('Is equal to'),
      'method' => 'opSimple',
      'short' => $this->t('='),
      'values' => 1,
    ],
    '!=' => [
      'title' => $this->t('Is not equal to'),
      'method' => 'opSimple',
      'short' => $this->t('!='),
      'values' => 1,
    ],
    '>=' => [
      'title' => $this->t('Is greater than or equal to'),
      'method' => 'opSimple',
      'short' => $this->t('>='),
      'values' => 1,
    ],
    '>' => [
      'title' => $this->t('Is greater than'),
      'method' => 'opSimple',
      'short' => $this->t('>'),
      'values' => 1,
    ],
    'between' => [
      'title' => $this->t('Is between'),
      'method' => 'opBetween',
      'short' => $this->t('between'),
      'values' => 2,
    ],
    'not between' => [
      'title' => $this->t('Is not between'),
      'method' => 'opBetween',
      'short' => $this->t('not between'),
      'values' => 2,
    ],
    'regular_expression' => [
      'title' => $this->t('Regular expression'),
      'short' => $this->t('regex'),
      'method' => 'opRegex',
      'values' => 1,
    ],
    'not_regular_expression' => [
      'title' => $this->t('Negated regular expression'),
      'short' => $this->t('not regex'),
      'method' => 'opNotRegex',
      '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.