{#
 # This file is part of the CRUDlex package.
 #
 # (c) Philip Lehmann-Böhm <philip@philiplb.de>
 #
 # For the full copyright and license information, please view the LICENSE
 # file that was distributed with this source code.
 #}

{% include crud.getTemplate('template', 'fieldLabel', crudEntity) with {
    field: field,
    definition: crudData.getDefinition(),
    annotations: annotations
} only %}
<select class="form-control" id="{{ field }}" name="{{ fieldNamePrefix ~ field }}">
    <option value=""></option>
    {% set values = crudData.getIdToNameMap(crudData.getDefinition().getSubTypeField(field, 'reference', 'entity'), crudData.getDefinition().getSubTypeField(field, 'reference', 'nameField')) %}
    {% for id, referenceValue in values %}
        <option value="{{ id }}" {% if value and id == value['id'] %}selected="selected" {% endif %}>{{ referenceValue }}</option>
    {% endfor %}
</select>
