Security update to Drupal 8.4.6
[yaffs-website] / web / core / modules / taxonomy / src / Plugin / views / argument / IndexTid.php
1 <?php
2
3 namespace Drupal\taxonomy\Plugin\views\argument;
4
5 use Drupal\taxonomy\Entity\Term;
6 use Drupal\views\Plugin\views\argument\ManyToOne;
7
8 /**
9  * Allow taxonomy term ID(s) as argument.
10  *
11  * @ingroup views_argument_handlers
12  *
13  * @ViewsArgument("taxonomy_index_tid")
14  */
15 class IndexTid extends ManyToOne {
16
17   public function titleQuery() {
18     $titles = [];
19     $terms = Term::loadMultiple($this->value);
20     foreach ($terms as $term) {
21       $titles[] = \Drupal::entityManager()->getTranslationFromContext($term)->label();
22     }
23     return $titles;
24   }
25
26 }