{% trans_default_domain "admin" %} {% if config.form is not empty %} {{ form_start(config.form) }} {{ form_errors(config.form) }} {% if config.form.vars.grouping is defined and config.form.vars.grouping is not empty %} {% for label, groups in config.form.vars.grouping %} {% set isLast = (loop.index == config.form.vars.grouping|length) %}

{{ label|trans }}

{% for child in groups %}
{{ form_errors(attribute(config.form, child)) }} {{ form_label(attribute(config.form, child)) }} {{ form_widget(attribute(config.form, child)) }}
{% endfor %} {{ form_rest(config.form) }}
{% if isLast %} {% endif %}
{% endfor %} {% else %}
{# Determine if its necessary to add the checkbox, if we only have 1 element we shouldn't bother #} {% set addCheckbox = true %} {% if config.form.children._token is defined %} {% set addCheckbox = config.form.children|length > 2 %} {% else %} {% set addCheckbox = config.form.children > 1 %} {% endif %} {% for child in config.form.children %} {% if child.vars.name != '_token' %}
{{ form_errors(child) }} {% if addCheckbox %} {% endif %} {{ form_label(child) }} {{ form_widget(child) }}
{% else %} {{ form_row(child) }} {% endif %} {% endfor %}
{% endif %} {{ form_end(config.form) }} {% endif %}