core/Fields/Definitions/templates/select/default.twig
{% extends Form.getLayout() %}
{% block fieldmarkup %}
{% if (Field.getArg('options')) %}
{% else %}
<p>Please set options to show</p>
{% endif %}
<select id='{{ Form.getInputFieldId() }}'
{% for attr, value in Field.getArg('attributes', []) %}
{{ attr }}="{{ value|esc_attr }}"
{% endfor %}
{% if Field.getArg('select2', false) %} data-kbselect2="true" {% endif %}
{% if Field.getArg('multiple', false) %} multiple="multiple" {% endif %}
{% if Field.getArg('multiple') %}
name='{{ Form.getFieldName(true) }}'
{% else %}
name='{{ Form.getFieldName() }}'
{% endif %}
style="width: {{ Field.getArg('width', '280px') }}">
{% if (Field.getArg('empty', true)) %}
<option value='' name=''>Bitte wählen</option>
{% endif %}
{% if Field.getArg('multiple') %}
{% for o in Field.getArg('options') %}
<option {% if ( o.value in Field.getValue()) %} selected="selected" {% endif %}
value='{{ o.value|escape('html_attr') }}'>{{ o.name }}</option>
{% endfor %}
{% else %}
{% for o in Field.getArg('options') %}
<option {% if (Field.getValue == o.value) %} selected="selected" {% endif %}
value='{{ o.value|escape('html_attr') }}'>{{ o.name }}</option>
{% endfor %}
{% endif %}
</select>
{% endblock %}