{% set config = { sorting: current } %}
{% set showSorting = (slot.config.showSorting.value is defined) ? slot.config.showSorting.value : true %}

{% if showSorting and sortings|length > 0 %}
    <div class="sorting"
         data-listing-sorting="true"
         {# ludtwig-ignore html-string-quotation #}
         data-listing-sorting-options='{{ config|json_encode }}'>
        <select class="sorting form-select" aria-label="{{ 'general.sortingLabel'|trans|striptags }}">
            {% for sorting in sortings %}
                {% set key = sorting.key %}
                <option value="{{ key }}"{% if key == current %} selected{% endif %}>{{ sorting.translated.label|sw_sanitize }}</option>
            {% endfor %}
        </select>
    </div>
{% endif %}
