{% trans_default_domain 'sections' %}

<form {{ attributes.defaults({id: 'wpj-filter-sort'}) }} onchange="this.dataset.controlledBy || this.submit()" data-wpj-filter-sort>
   <div>
      <p>{{ this.title|default('sort.by'|trans) }}</p>
      {% if this.orderTooltip %}
         <i class="tooltip">
            {# todo #}
            <twig:ux:icon name="tooltip-info" class="c-icon"/>
            <span>{{ this.orderTooltip }}</span>
         </i>
      {% endif %}
   </div>
   {% for value, label in this.sortChoices %}
      <label for="order_{{ value }}">
         <input type="radio" name="order" id="order_{{ value }}" value="{{ value }}" {% if value == this.chosenSort %}checked{% endif %}>
         <span class="filter-sort-title">{{ label }}</span>
      </label>
   {% endfor %}
</form>
