class Taxonomy

Same name and namespace in other branches
  1. 11.x 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

Related topics

103 string references to 'Taxonomy'
BreadcrumbTest::testBreadCrumbs in core/modules/system/tests/src/Functional/Menu/BreadcrumbTest.php
Tests breadcrumbs on node and administrative paths.
core.entity_view_mode.taxonomy_term.full.yml in core/modules/taxonomy/config/install/core.entity_view_mode.taxonomy_term.full.yml
core/modules/taxonomy/config/install/core.entity_view_mode.taxonomy_term.full.yml
CreateTestContentEntitiesTrait::getRequiredModules in core/modules/migrate_drupal/tests/src/Traits/CreateTestContentEntitiesTrait.php
Gets required modules.
demo_umami.info.yml in core/profiles/demo_umami/demo_umami.info.yml
core/profiles/demo_umami/demo_umami.info.yml
DependencyTest::testUninstallDependents in core/modules/system/tests/src/Functional/Module/DependencyTest.php
Tests attempting to uninstall a module that has installed dependents.

... 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');
  }

}

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