{% use "form_div_layout.html.twig" %} {# Form row with Metronic styling #} {% block form_row -%} {% if compound is defined and compound %} {%- set element = 'fieldset' -%} {% endif %} {% set row_class = (row_class|default('') ~ ' form-group row')|trim %}
{{- form_label(form) -}}
{{- form_widget(form) -}} {{- form_errors(form) -}}
{%- endblock form_row %} {# Form label with Metronic styling #} {% block form_label -%} {% if label is not same as(false) -%} {% if not compound -%} {% set label_attr = label_attr|merge({'for': id}) %} {%- endif -%} {% set label_attr = label_attr|merge({'class': (label_attr.class|default('col-2 col-form-label font-weight-bold'))|trim}) %} {% if required -%} {% set label_attr = label_attr|merge({'class': (label_attr.class ~ ' 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 -%} {{ translation_domain is same as(false) ? label : label|trans(label_translation_parameters, translation_domain) }} {%- endif -%} {%- endblock form_label %} {# Form widget with Metronic styling #} {% block form_widget -%} {% if compound %} {{- block('form_widget_compound') -}} {% else %} {{- block('form_widget_simple') -}} {% endif %} {%- endblock form_widget %} {# Simple form widget with Metronic styling #} {% block form_widget_simple -%} {% set type = type|default('text') %} {% set attr = attr|merge({'class': (attr.class|default('') ~ ' form-control')|trim}) %} {%- endblock form_widget_simple %} {# Select widget with Metronic styling #} {% block choice_widget_collapsed -%} {% set attr = attr|merge({'class': (attr.class|default('') ~ ' form-select')|trim}) %} {{- parent() -}} {%- endblock choice_widget_collapsed %} {# Textarea widget with Metronic styling #} {% block textarea_widget -%} {% set attr = attr|merge({'class': (attr.class|default('') ~ ' form-control')|trim}) %} {{- parent() -}} {%- endblock textarea_widget %} {# Checkbox widget with Metronic styling #} {% block checkbox_widget -%}
{%- endblock checkbox_widget %} {# Radio widget with Metronic styling #} {% block radio_widget -%}
{%- endblock radio_widget %} {# Form errors with Metronic styling #} {% block form_errors -%} {% if errors|length > 0 -%}
{% for error in errors %} {{ error.message }} {% if not loop.last %}
{% endif %} {% endfor %}
{%- endif %} {%- endblock form_errors %} {# Button row with Metronic styling #} {% block button_row -%}
{{- form_widget(form) -}}
{%- endblock button_row %} {# Button widget with Metronic styling #} {% block button_widget -%} {% set attr = attr|merge({'class': (attr.class|default('btn') ~ ' btn-bold')|trim}) %} {{- parent() -}} {%- endblock button_widget %} {# Submit button widget with Metronic styling #} {% block submit_widget -%} {% set attr = attr|merge({'class': (attr.class|default('btn btn-primary') ~ ' btn-bold')|trim}) %} {{- parent() -}} {%- endblock submit_widget %} {# Reset button widget with Metronic styling #} {% block reset_widget -%} {% set attr = attr|merge({'class': (attr.class|default('btn btn-secondary') ~ ' btn-bold')|trim}) %} {{- parent() -}} {%- endblock reset_widget %}