{% sw_extends '@Storefront/storefront/element/cms-element-sidebar-filter.html.twig' %}
{# append category name and filtered product amount above parent #}
{% block element_sidebar_filter %}
{% set currentCategory = page.header.navigation.active %}
{% if currentCategory.customFields.s360_listingviewswitch_remove_h1 != true %}
<div class="cms-element-sidebar__additional-info">
<h1 class="cms-element-sidebar__additional-info--category">
{% if currentCategory.customFields and currentCategory.customFields.custom_category_configuration_display_name %}
{{ currentCategory.customFields.custom_category_configuration_display_name }}
{% else %}
{{ currentCategory.translated.name }}
{% endif %}
{# amount of product for category and filters will be inserted in listing so it updates on reload #}
</h1>
</div>
{% endif %}
{# actual filters start here #}
{% set config = element.fieldConfig.elements %}
{% set slot = page.cmsPage.firstElementOfType('product-listing') %}
{% set listing = slot.data.listing %}
{% if slot.data.listing.aggregations.elements|length > 0 %}
<div class="row">
<div class="cms-element-sidebar-filter col-6 col-lg-12">
{% block element_product_listing_filter_button %}
<button class="btn header-actions-btn filter-panel-wrapper-toggle filter-panel-wrapper-toggle--filter"
type="button"
data-offcanvas-filter="true"
aria-haspopup="true"
aria-expanded="false"
aria-label="{{ "general.menuLink"|trans }}">
<span class="filter-panel-wrapper-toggle__text">{{ "listing.filter"|trans }}</span>
{% block element_product_listing_filter_button_icon %}
{% sw_icon 'pfeil_rechts' style {'pack': 'grimmtheme', 'namespace': 'GrimmTheme', 'size': 'xs'} %}
{% endblock %}
</button>
{% endblock %}
{% block element_sidebar_filter_panel %}
{{ parent() }}
{% endblock %}
</div>
</div>
{% endif %}
{% endblock %}