You are here

public function Term::init in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/taxonomy/src/Plugin/views/argument_validator/Term.php \Drupal\taxonomy\Plugin\views\argument_validator\Term::init()

Initialize the plugin.

Parameters

\Drupal\views\ViewExecutable $view: The view object.

\Drupal\views\Plugin\views\display\DisplayPluginBase $display: The display handler.

array $options: The options configured for this plugin.

Overrides PluginBase::init

File

core/modules/taxonomy/src/Plugin/views/argument_validator/Term.php, line 22
Contains \Drupal\taxonomy\Plugin\views\argument_validator\Term.

Class

Term
Adds legacy vocabulary handling to standard Entity Argument validation..

Namespace

Drupal\taxonomy\Plugin\views\argument_validator

Code

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

  // @todo Remove the legacy code.
  // Convert legacy vids option to machine name vocabularies.
  if (!empty($this->options['vids'])) {
    $vocabularies = taxonomy_vocabulary_get_names();
    foreach ($this->options['vids'] as $vid) {
      if (isset($vocabularies[$vid], $vocabularies[$vid]->machine_name)) {
        $this->options['vocabularies'][$vocabularies[$vid]->machine_name] = $vocabularies[$vid]->machine_name;
      }
    }
  }
}