{% set container_class = container_class ?? null %}
{% set class = class ?? '' %}
{% set label = label ?? null %}
{% set label_class = label_class ?? false %}
{% set form = formAttr ?? false %}
{% set formAttr = formAttr ?? false %}
{% set active_option = active_option ?? null %}
{% set attributes = attributes ?? {} %}
{% set noOptional = noOptional ?? false %}
{% set no_label = no_label ?? false %}
{% set name = name ?? false %}
{% set required = required ?? false %}
{% set id = id ?? null %}
{% if not name and useLabelAsInputName ?? false %}
{% set name = label %}
{% endif %}
{% if container_class %}
<div class="{{ container_class }}">
{% endif %}
{% if field is defined and field is not null %}
{% if not no_label %}{{ form_label(field, label, {'label_attr': {'class': label_class},'noOptional' : noOptional}) }}{% endif %}
{% set attributes = attributes|merge(field.vars.attr)|merge({'class': class ~ ' ' ~ (field.vars.attr.class ?? '')}) %}
{% if formAttr %}
{% set attributes = attributes|merge({'form': formAttr}) %}
{% endif %}
{{ form_widget(field, {'attr': attributes, 'id': id ?? field.vars.id}) }}
{{ form_errors(field) }}
{% else %}
{% if label %}
<label for="{{ id }}" class="{{ label_class }}">{{ label }}</label>
{% endif %}
<select
class="{{ class }}"
id="{{ id }}"
name = "{{ name }}"
{% if form %}
form={{ form.id ? form.id : form }}
{% endif %}
{% if required %}
required
{% endif %}
>
{% for option in options %}
{% if not option.value ?? false and useRadioLabelAsValue ?? false %}
{% set option = option|merge({value:option.label}) %}
{% endif %}
<option
value="{{ option.value }}"
{% if option.toggle_id is defined %}data-toggle-id="{{ option.toggle_id }}"{% endif %}
{% if active_option == option.value %}selected{% endif %}
>{{ option.label }}</option>
{% endfor %}
</select>
{% endif %}
{% if container_class %}
</div>
{% endif %}