Skip to main content

Drupal 8: Get the raw taxonomy term name.

  1. /**
  2.  * Implements template_preprocess_taxonomy_term().
  3.  */
  4. function THEME_preprocess_taxonomy_term(&$variables) {
  5.   // Add the term name as a variable to use as a class in the twig file.
  6.   $variables['term_name'] = $variables['term']->label();
  7. }


Comments