function TaxonomyThemeHooks::themeSuggestionsTaxonomyTerm

Implements hook_theme_suggestions_HOOK().

Attributes

#[Hook('theme_suggestions_taxonomy_term')]

File

core/modules/taxonomy/src/Hook/TaxonomyThemeHooks.php, line 15

Class

TaxonomyThemeHooks
Hook implementations for taxonomy.

Namespace

Drupal\taxonomy\Hook

Code

public function themeSuggestionsTaxonomyTerm(array $variables) : array {
  $suggestions = [];
  /** @var \Drupal\taxonomy\TermInterface $term */
  $term = $variables['elements']['#taxonomy_term'];
  $suggestions[] = 'taxonomy_term__' . $term->bundle();
  $suggestions[] = 'taxonomy_term__' . $term->id();
  return $suggestions;
}

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