{% use "bootstrap_5_layout.html.twig" %} {# Labels #} {% block form_label -%} {%- if label is same as(false) -%}
{%- else -%} {%- set row_class = row_class|default(row_attr.class|default('')) -%} {%- if 'form-floating' not in row_class and 'input-group' not in row_class -%} {%- if expanded is not defined or not expanded -%} {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' col-form-label')|trim}) -%} {%- endif -%} {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ block('form_label_class'))|trim}) -%} {%- endif -%} {{- parent() -}} {%- endif -%} {%- endblock form_label %} {% block form_label_class -%} col-sm-2 {%- endblock form_label_class %} {# Rows #} {% block form_row -%} {%- if expanded is defined and expanded -%} {{ block('fieldset_form_row') }} {%- else -%} {%- set widget_attr = {} -%} {%- if help is not empty -%} {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} {%- endif -%} {%- set row_class = row_class|default(row_attr.class|default('mb-3')) -%} {%- set is_form_floating = is_form_floating|default('form-floating' in row_class) -%} {%- set is_input_group = is_input_group|default('input-group' in row_class) -%} {#- Remove behavior class from the main container -#} {%- set row_class = row_class|replace({'form-floating': '', 'input-group': ''}) -%} {%- if is_form_floating or is_input_group -%}
{%- if is_form_floating -%}
{{- form_widget(form, widget_attr) -}} {{- form_label(form) -}}
{%- elseif is_input_group -%}
{{- form_label(form) -}} {{- form_widget(form, widget_attr) -}} {#- Hack to properly display help with input group -#} {{- form_help(form) -}}
{%- endif -%} {%- if not is_input_group -%} {{- form_help(form) -}} {%- endif -%} {{- form_errors(form) -}}
{%- else -%} {{- form_label(form) -}}
{{- form_widget(form, widget_attr) -}} {{- form_help(form) -}} {{- form_errors(form) -}}
{%- endif -%} {##} {%- endif -%} {%- endblock form_row %} {% block fieldset_form_row -%} {%- set widget_attr = {} -%} {%- if help is not empty -%} {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} {%- endif -%}
{{- form_label(form) -}}
{{- form_widget(form, widget_attr) -}} {{- form_help(form) -}} {{- form_errors(form) -}}
{%- endblock fieldset_form_row %} {% block submit_row -%} {#--#}
{#--#}
{{- form_widget(form) -}}
{#--#} {%- endblock submit_row %} {% block reset_row -%} {#--#}
{#--#}
{{- form_widget(form) -}}
{#--#} {%- endblock reset_row %} {% block button_row -%} {#--#}
{#--#}
{{- form_widget(form) -}}
{#--#} {%- endblock button_row %} {% block checkbox_row -%} {#--#}
{#--#}
{{- form_widget(form) -}} {{- form_help(form) -}} {{- form_errors(form) -}}
{#--#} {%- endblock checkbox_row %} {% block form_group_class -%} col-sm-10 {%- endblock form_group_class %}