{% block choice_widget %} {% spaceless %} <div {{ block('widget_container_attributes') }}> {% if expanded %} {%- for child in form %} <div class="form-check"> <input type="checkbox" id="{{ child.vars.id }}" name="{{ child.vars.full_name }}" value="{{ child.vars.value }}" class="form-check-input"> <label class="form-check-label" for="{{ child.vars.id }}"> <i class="{{ child.vars.attr['class'] }}"></i> {{ child.vars.label }} </label> </div> {%- endfor -%} {% else %} <select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}> {% if placeholder is not none %} <option value=""{% if required and value is empty %} selected="selected"{% endif %}>{{ placeholder|trans({}, translation_domain) }}</option> {% endif %} {% if preferred_choices|length > 0 %} {% set options = preferred_choices %} {{ block('choice_widget_options') }} {% if choices|length > 0 and separator is not none %} <option disabled="disabled">{{ separator }}</option> {% endif %} {% endif %} {% set options = choices %} {{ block('choice_widget_options') }} </select> {% endif %} </div> {% endspaceless %} {% endblock choice_widget %}