Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

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\Attribute\ViewsArgument;
use Drupal\views\Plugin\views\argument\ManyToOne;

/**
 * Allow taxonomy term ID(s) as argument.
 *
 * @ingroup views_argument_handlers
 */
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.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal