IndexTid.php

Same filename in other branches
  1. 9 core/modules/taxonomy/src/Plugin/views/argument/IndexTid.php
  2. 10 core/modules/taxonomy/src/Plugin/views/argument/IndexTid.php
  3. 11.x core/modules/taxonomy/src/Plugin/views/argument/IndexTid.php

Namespace

Drupal\taxonomy\Plugin\views\argument

File

core/modules/taxonomy/src/Plugin/views/argument/IndexTid.php

View source
<?php

namespace Drupal\taxonomy\Plugin\views\argument;

use Drupal\taxonomy\Entity\Term;
use Drupal\views\Plugin\views\argument\ManyToOne;

/**
 * Allow taxonomy term ID(s) as argument.
 *
 * @ingroup views_argument_handlers
 *
 * @ViewsArgument("taxonomy_index_tid")
 */
class IndexTid extends ManyToOne {
    public function titleQuery() {
        $titles = [];
        $terms = Term::loadMultiple($this->value);
        foreach ($terms as $term) {
            $titles[] = \Drupal::service('entity.repository')->getTranslationFromContext($term)
                ->label();
        }
        return $titles;
    }

}

Classes

Title Deprecated Summary
IndexTid Allow taxonomy term ID(s) as argument.

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