You are here

function WebformSubmissionFieldFilter::operators in Webform Views Integration 8.5

This kind of construct makes it relatively easy for a child class to add or remove functionality by overriding this function and adding/removing items from this array.

Overrides StringFilter::operators

3 calls to WebformSubmissionFieldFilter::operators()
WebformSubmissionComputedFilter::operators in src/Plugin/views/filter/WebformSubmissionComputedFilter.php
This kind of construct makes it relatively easy for a child class to add or remove functionality by overriding this function and adding/removing items from this array.
WebformSubmissionFieldFilter::valueForm in src/Plugin/views/filter/WebformSubmissionFieldFilter.php
Provide a simple textfield for equality
WebformSubmissionHiddenFilter::operators in src/Plugin/views/filter/WebformSubmissionHiddenFilter.php
This kind of construct makes it relatively easy for a child class to add or remove functionality by overriding this function and adding/removing items from this array.
2 methods override WebformSubmissionFieldFilter::operators()
WebformSubmissionComputedFilter::operators in src/Plugin/views/filter/WebformSubmissionComputedFilter.php
This kind of construct makes it relatively easy for a child class to add or remove functionality by overriding this function and adding/removing items from this array.
WebformSubmissionHiddenFilter::operators in src/Plugin/views/filter/WebformSubmissionHiddenFilter.php
This kind of construct makes it relatively easy for a child class to add or remove functionality by overriding this function and adding/removing items from this array.

File

src/Plugin/views/filter/WebformSubmissionFieldFilter.php, line 194

Class

WebformSubmissionFieldFilter
Filter based on value of a webform submission.

Namespace

Drupal\webform_views\Plugin\views\filter

Code

function operators() {
  $operators = parent::operators();

  // We additionally mark each operator as whether it should use element form
  // or just a text field. For example, when you filter by email, generally
  // you want to use #type => 'email', i.e. the element form, but when you do
  // "contains" or "regex" or similar operator, you want to have just a text
  // field.
  $operator_map = [
    '=' => self::ELEMENT_TYPE,
    '!=' => self::ELEMENT_TYPE,
    'contains' => 'textfield',
    'word' => 'textfield',
    'allwords' => 'textfield',
    'starts' => 'textfield',
    'not_starts' => 'textfield',
    'ends' => 'textfield',
    'not_ends' => 'textfield',
    'not' => 'textfield',
    'shorterthan' => 'number',
    'longerthan' => 'number',
    'regular_expression' => 'textfield',
  ];
  foreach ($operators as $k => $v) {
    if (isset($operator_map[$k])) {
      $operators[$k]['webform_views_element_type'] = $operator_map[$k];
    }
  }
  return $operators;
}