{% use "bootstrap_5_layout.html.twig" %} {% 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 -%} <{{ element|default('div') }} class="form-group"> {{- form_label(form) -}} {{- form_widget(form) -}} {{- form_help(form) -}} {{ element|default('div') }}> {%- 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, class: (label_attr.class|default('') ~ ' form-label')|trim}) -%} {%- 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 -%} {% if translation_domain is not same as (false) %} {% set label = label|trans({}, translation_domain) %} {% endif %} <{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ label|raw|parse_icons }}{{- form_errors(form) -}}{{ element|default('label') }}> {%- endif -%} {%- endblock form_label %} {% block button_widget %} {% apply spaceless %} {% if label is empty and label is not same as (false) %} {% set label = name|humanize %} {% endif %} {% if type is defined and type == 'submit' %} {% set attr = attr|merge({ 'class': (attr.class|default('') ~ ' btn btn-'~button_class|default('primary'))|trim }) %} {% else %} {% set attr = attr|merge({ 'class': (attr.class|default('') ~ ' btn btn-'~button_class|default('secondary'))|trim }) %} {% endif %} {% if translation_domain is not same as (false) %} {% set label = label|trans({}, translation_domain) %} {% endif %} {% if as_link is defined and as_link == true %} {% if attr.icon is defined and attr.icon != '' %}{{ icon(attr.icon) }}{% endif -%}{{ label }} {% else %} {% endif %} {% endapply %} {% endblock button_widget %} {% block submit_widget %} {% apply spaceless %} {% set type = type|default('submit') %} {{ block('button_widget') }} {% endapply %} {% endblock submit_widget %} {% block reset_widget %} {% apply spaceless %} {% set type = type|default('reset') %} {{ block('button_widget') }} {% endapply %} {% endblock reset_widget %} {% block form_actions_widget %} {% for button in form.children %} {{ form_widget(button) }} {# this needs to be here due to https://github.com/twbs/bootstrap/issues/3245 #} {% endfor %} {% endblock %} {% block role_widget %} {% apply spaceless %}
{{ 'role.full'|trans }} | |
---|---|
|