You are here

public function ListField::init in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/options/src/Plugin/views/filter/ListField.php \Drupal\options\Plugin\views\filter\ListField::init()

Overrides \Drupal\views\Plugin\views\HandlerBase::init().

Provide some extra help to get the operator/value easier to use.

This likely has to be overridden by filters which are more complex than simple operator/value.

Overrides ManyToOne::init

File

core/modules/options/src/Plugin/views/filter/ListField.php, line 24

Class

ListField
Filter handler which uses list-fields as options.

Namespace

Drupal\options\Plugin\views\filter

Code

public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
  parent::init($view, $display, $options);
  $field_storage = $this
    ->getFieldStorageDefinition();

  // Set valueOptions here so getValueOptions() will just return it.
  $this->valueOptions = options_allowed_values($field_storage);
}