You are here

public function Term::init in Views (for Drupal 7) 8.3

Initialize this plugin with the view and the argument it is linked to.

Overrides ArgumentValidatorPluginBase::init

File

lib/Views/taxonomy/Plugin/views/argument_validator/Term.php, line 26
Definition of Views\taxonomy\Plugin\views\argument_validator\Term.

Class

Term
Validate whether an argument is an acceptable node.

Namespace

Views\taxonomy\Plugin\views\argument_validator

Code

public function init(ViewExecutable $view, &$argument, $options) {
  parent::init($view, $argument, $options);

  // 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;
      }
    }
  }
}