<div id="categories">
{%- if rtl -%}
    {% for category in categories | reverse -%}
    <a>
        <input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} />{{- '' -}}
        <label for="checkbox_{{ category|replace(' ', '_') }}">{{ _(category) }}</label>
    </a>
    {%- endfor %}
{%- else -%}
    {% for category in categories -%}
    <a>
        <input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} />{{- '' -}}
        <label for="checkbox_{{ category|replace(' ', '_') }}">{{ _(category) }}</label>
    </a>
    {%- endfor %}
{%- endif -%}
</div>
