You are here

public function SynonymsEntity::init in Synonyms 8

Same name and namespace in other branches
  1. 2.0.x modules/synonyms_views_filter/src/Plugin/views/filter/SynonymsEntity.php \Drupal\synonyms_views_filter\Plugin\views\filter\SynonymsEntity::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 FilterPluginBase::init

File

synonyms_views_filter/src/Plugin/views/filter/SynonymsEntity.php, line 77

Class

SynonymsEntity
Filter entity by its name or one of its synonyms.

Namespace

Drupal\synonyms_views_filter\Plugin\views\filter

Code

public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
  parent::init($view, $display, $options);
  switch ($this->options['widget']) {
    case 'autocomplete':
      $this->operator = 'IN';
      break;
    case 'select':
      $this->operator = !$this
        ->isExposed() || $this->options['expose']['multiple'] ? 'IN' : '=';
      break;
  }
}