diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index d58064d..bd53bba 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -320,10 +320,7 @@ function template_preprocess_taxonomy_term(&$variables) { $variables['content'][$key] = $variables['elements'][$key]; } - // Gather classes, and clean up name so there are no underscores. - $variables['attributes']['class'][] = 'taxonomy-term'; - $vocabulary_name_css = str_replace('_', '-', $term->bundle()); - $variables['attributes']['class'][] = 'vocabulary-' . $vocabulary_name_css; + $variables['vocabulary_name'] = $term->bundle(); } /** diff --git a/core/modules/taxonomy/templates/taxonomy-term.html.twig b/core/modules/taxonomy/templates/taxonomy-term.html.twig index 2ecc713..dce03e0 100644 --- a/core/modules/taxonomy/templates/taxonomy-term.html.twig +++ b/core/modules/taxonomy/templates/taxonomy-term.html.twig @@ -29,7 +29,13 @@ * @ingroup themeable */ #} -
+{% + set classes = [ + 'taxonomy-term', + 'vocabulary-' ~ vocabulary_name|clean_class, + ] +%} +
{{ title_prefix }} {% if not page %}

{{ name }}