{% use "_partial/form_base_layout.html.twig" %} {% block form_errors -%} {%- if errors|length > 0 -%} {%- for error in errors -%} {{ error.message }} {%- endfor -%} {%- endif %} {%- endblock form_errors %} {% block form_row -%} {%- if compound is defined and compound -%} {%- set element = 'fieldset' -%} {%- endif -%} {%- set widget_attr = {} -%} {%- if help is not empty -%} {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} {%- endif -%} {% set extraClass = ' form-group' %} {% if errors|length > 0 %} {% set extraClass = extraClass ~ ' error' %} {% endif %} <{{ element|default('div') }}{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ extraClass)|trim})} %}{{ block('attributes') }}{% endwith %}> {{- form_label(form) -}} {{- form_widget(form, widget_attr) -}} {{- form_errors(form) -}} {{- form_help(form) -}} {%- endblock form_row %} {% block form_label -%} {% if label is not same as(false) -%} {%- if compound is defined and compound -%} {%- set element = 'legend' -%} {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' col-form-label')|trim}) -%} {%- else -%} {%- set label_attr = label_attr|merge({for: id}) -%} {%- endif -%} {% if required -%} {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) %} {%- endif -%} {% if label is empty -%} {%- if label_format is not empty -%} {% set label = label_format|replace({ '%name%': name, '%id%': id, }) %} {%- else -%} {% set label = name|humanize %} {%- endif -%} {%- endif -%} <{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ translation_domain is same as(false) ? label : label|trans(label_translation_parameters, translation_domain) }} {% if required -%} * {% endif %} {%- endif -%} {%- endblock form_label %} {%- block choice_widget_options -%} {% for group_label, choice in options %} {%- if choice is iterable -%} {% set options = choice %} {{- block('choice_widget_options') -}} {%- else -%} {% endif %} {% endfor %} {%- endblock choice_widget_options -%}