I've added a custom twig template for links--language-block.html.twig.
Inside of it, I want to render additional HTML when the current item is active. But I can't figure out how to check when the current item is active.
{% if links -%}
{%- if attributes.hasClass('inline') -%}
<ul{{ attributes.addClass('list-inline') }}>
{%- else -%}
<ul{{ attributes }}>
{%- endif -%}
{%- for key, item in links -%}
{% if item.attributes.hasClass('is-active') %} << this is always false
<li>foobar</li>
{%- endif -%}
<li{{ item.attributes.addClass('dropdown') }}>
{%- if item.link -%}
{{ item.link }}
{# <a class="dropdown-toggle" data-target="#" data-toggle="dropdown">Deutsch <span class="caret"></span></a> #}
{%- elseif item.text_attributes -%}
<span{{ item.text_attributes }}>{{ item.text }}</span>
{%- else -%}
{{ item.text }}
{%- endif -%}
</li>
{%- endfor -%}
</ul>
{%- endif %}
How can I check if the link as the active class?
is-active
class?kint
the finala
tag has not the active class, only in the browser. it is not javascript, i've checked that