TaxonomyThemeHooks.php

Namespace

Drupal\taxonomy\Hook

File

core/modules/taxonomy/src/Hook/TaxonomyThemeHooks.php

View source
<?php

namespace Drupal\taxonomy\Hook;

use Drupal\Core\Hook\Attribute\Hook;

/**
 * Hook implementations for taxonomy.
 */
class TaxonomyThemeHooks {
  
  /**
   * Implements hook_theme_suggestions_HOOK().
   */
  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;
  }

}

Classes

Title Deprecated Summary
TaxonomyThemeHooks Hook implementations for taxonomy.

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