{% extends "@bazar/layouts/input.twig" %}

{% block input %}
    <select
        id="{{ field.propertyName }}"
        name="{{ field.propertyName }}{% if field.maxChars and field.maxChars > 1 %}[]{% endif %}"
        class="form-control"
        {% if field.maxChars and field.maxChars > 1 %}multiple="multiple" size="{{ field.maxChars }}"{% endif %}
        {% if field.required %}required{% endif %}
        {% if field.default is not empty %}data-default="{{ field.default }}"{% endif %}
    >
        {% if not value %}
            <option value='' selected="selected">{{ _t('BAZ_CHOISIR') }}</option>
        {% else %}{# To be able to unselect we need an empty option#}
            <option value=''></option>
        {% endif %}
        {% for key, option in options %}
            <option value={{ key }} {% if value == key %}selected{% endif %}>{{ option|raw }}</option>
        {% endfor %}
    </select>
{% endblock %}
