You are here

public function Taxonomy::title 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::title()
  2. 9 core/modules/taxonomy/src/Plugin/views/argument/Taxonomy.php \Drupal\taxonomy\Plugin\views\argument\Taxonomy::title()

Override the behavior of title(). Get the title of the node.

Overrides NumericArgument::title

File

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

Class

Taxonomy
Argument handler for basic taxonomy tid.

Namespace

Drupal\taxonomy\Plugin\views\argument

Code

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