You are here

class Taxonomy in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/taxonomy/src/Plugin/views/argument/Taxonomy.php \Drupal\taxonomy\Plugin\views\argument\Taxonomy
  2. 9 core/modules/taxonomy/src/Plugin/views/argument/Taxonomy.php \Drupal\taxonomy\Plugin\views\argument\Taxonomy

Argument handler for basic taxonomy tid.

Plugin annotation

@ViewsArgument("taxonomy");

Hierarchy

Expanded class hierarchy of Taxonomy

15 string references to 'Taxonomy'
BreadcrumbTest::testBreadCrumbs in core/modules/system/tests/src/Functional/Menu/BreadcrumbTest.php
Tests breadcrumbs on node and administrative paths.
drupal6.php in core/modules/migrate_drupal/tests/fixtures/drupal6.php
A database agnostic dump for testing purposes.
drupal7.php in core/modules/tracker/tests/fixtures/drupal7.php
A database agnostic dump for testing purposes.
drupal7.php in core/modules/rdf/tests/fixtures/drupal7.php
A database agnostic dump for testing purposes.
drupal7.php in core/modules/migrate_drupal/tests/fixtures/drupal7.php
A database agnostic dump for testing purposes.

... See full list

File

core/modules/taxonomy/src/Plugin/views/argument/Taxonomy.php, line 17

Namespace

Drupal\taxonomy\Plugin\views\argument
View source
class Taxonomy extends NumericArgument implements ContainerFactoryPluginInterface {

  /**
   * @var \Drupal\Core\Entity\EntityStorageInterface
   */
  protected $termStorage;

  /**
   * {@inheritdoc}
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityStorageInterface $term_storage) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->termStorage = $term_storage;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static($configuration, $plugin_id, $plugin_definition, $container
      ->get('entity_type.manager')
      ->getStorage('taxonomy_term'));
  }

  /**
   * Override the behavior of title(). Get the title of the node.
   */
  public function title() {

    // There might be no valid argument.
    if ($this->argument) {
      $term = $this->termStorage
        ->load($this->argument);
      if (!empty($term)) {
        return $term
          ->getName();
      }
    }

    // TODO review text
    return $this
      ->t('No name');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
NumericArgument::$value public property The actual value which is used for querying.
NumericArgument::buildOptionsForm public function 1
NumericArgument::defineOptions protected function 1
NumericArgument::getContextDefinition public function
NumericArgument::getSortName public function
NumericArgument::query public function 1
NumericArgument::titleQuery public function Override for specific title lookups. 4
Taxonomy::$termStorage protected property
Taxonomy::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create
Taxonomy::title public function Override the behavior of title(). Get the title of the node. Overrides NumericArgument::title
Taxonomy::__construct public function