Commit cdad8d7f authored by alexpott's avatar alexpott

Issue #2329775 by lauriii | davidhernandez: Move taxonomy term classes from...

Issue #2329775 by lauriii | davidhernandez: Move taxonomy term classes from preprocess to templates.
parent d81f06f8
......@@ -319,11 +319,6 @@ function template_preprocess_taxonomy_term(&$variables) {
foreach (Element::children($variables['elements']) as $key) {
$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;
}
/**
......
......@@ -22,6 +22,7 @@
* - page: Flag for the full page state.
* - term: The taxonomy term entity, including:
* - id: The ID of the taxonomy term.
* - bundle: Machine name of the current vocabulary.
* - view_mode: View mode, e.g. 'full', 'teaser', etc.
*
* @see template_preprocess_taxonomy_term()
......@@ -29,7 +30,13 @@
* @ingroup themeable
*/
#}
<div id="taxonomy-term-{{ term.id }}"{{ attributes }}>
{%
set classes = [
'taxonomy-term',
'vocabulary-' ~ term.bundle|clean_class,
]
%}
<div id="taxonomy-term-{{ term.id }}"{{ attributes.addClass(classes)|without('id') }}>
{{ title_prefix }}
{% if not page %}
<h2><a href="{{ url }}">{{ name }}</a></h2>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment