function TaxonomyIndexTid::addSelfTokens

Same name in other branches
  1. 9 core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php \Drupal\taxonomy\Plugin\views\field\TaxonomyIndexTid::addSelfTokens()
  2. 10 core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php \Drupal\taxonomy\Plugin\views\field\TaxonomyIndexTid::addSelfTokens()
  3. 11.x core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php \Drupal\taxonomy\Plugin\views\field\TaxonomyIndexTid::addSelfTokens()

Overrides FieldPluginBase::addSelfTokens

File

core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php, line 171

Class

TaxonomyIndexTid
Field handler to display all taxonomy terms of a node.

Namespace

Drupal\taxonomy\Plugin\views\field

Code

protected function addSelfTokens(&$tokens, $item) {
    foreach ([
        'tid',
        'name',
        'vocabulary_vid',
        'vocabulary',
    ] as $token) {
        $tokens['{{ ' . $this->options['id'] . '__' . $token . ' }}'] = isset($item[$token]) ? $item[$token] : '';
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.