You are here

public function NodeTermData::init in Zircon Profile 8

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

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

Init handler to let relationships live on tables other than the table they operate on.

Overrides RelationshipPluginBase::init

File

core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php, line 65
Contains \Drupal\taxonomy\Plugin\views\relationship\NodeTermData.

Class

NodeTermData
Relationship handler to return the taxonomy terms of nodes.

Namespace

Drupal\taxonomy\Plugin\views\relationship

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