{% if app.request.get('currentTaxonSlug') %}
{% set currentTaxon = get_taxon_by_slug(app.request.get('currentTaxonSlug'), sylius.localeCode) %}
{% else %}
{% set currentTaxon = null %}
{% endif %}
{% macro item(taxon, isChild, currentTaxon = null) %}
{% import _self as macros %}
{% if taxon.enabledChildren|length > 0 %}
<li class="list-item">
<a class="list-link{% if currentTaxon and currentTaxon.root.id == taxon.root.id and (currentTaxon.left >= taxon.left and currentTaxon.right <= taxon.right) %} active{% endif %}" href="{{ path('sylius_shop_product_index', { 'slug': taxon.redirect ?: taxon.slug, '_locale': taxon.translation.locale }) }}" role="button">
{{ taxon.name }}
</a>
<ul class="list">
{% for childTaxon in taxon.enabledChildren %}
{{ macros.item(childTaxon, true, currentTaxon) }}
{% endfor %}
</ul>
</li>
{% else %}
<li class="list-item">
<a class="list-link{% if currentTaxon and currentTaxon.root.id == taxon.root.id and (currentTaxon.left >= taxon.left and currentTaxon.right <= taxon.right) %} active{% endif %}" href="{{ path('sylius_shop_product_index', { 'slug': taxon.redirect ?: taxon.slug, '_locale': taxon.translation.locale }) }}">
{{ taxon.name }}
</a>
</li>
{% endif %}
{% endmacro %}
{% import _self as macros %}
{% if taxons|length > 0 %}
<div class="sidenav mb-8">
<h3 class="sidenav-title">
<a class="link-heading" href="{{ path('sylius_shop_product_index', {'slug': taxons[0].redirect ?: taxons[0].slug, '_locale': taxons[0].translation.locale}) }}">{{ taxons[0].parent.name }}</a>
</h3>
<div class="sidenav-list-wrap list">
<ul class="sidenav-list list">
{% for taxon in taxons %}
{{ macros.item(taxon, false, currentTaxon) }}
{% endfor %}
</ul>
</div>
</div>
{% endif %}