{# This file is part of the Sonata package. (c) Thomas Rabaix For the full copyright and license information, please view the LICENSE file that was distributed with this source code. #} {# Labels #} {% block form_label %} {% spaceless %} {% if label is not sameas(false) %} {% set label_attr = label_attr|merge({'class': label_attr.class|default('') ~ " control-label" }) %} {% if not compound %} {% 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 %} {% set label = name|humanize %} {% endif %} {% if in_list_checkbox is defined and in_list_checkbox and widget is defined %} {{ widget|raw }} {% if not sonata_admin.admin %} {{- label|trans({}, translation_domain) -}} {% else %} {{- label|trans({}, sonata_admin.field_description.translationDomain) -}} {% endif%} {% else %} {% if not sonata_admin.admin%} {{- label|trans({}, translation_domain) -}} {% else %} {{ sonata_admin.admin.trans(label, {}, sonata_admin.field_description.translationDomain) }} {% endif %} {% endif %} {% endif %} {% endspaceless %} {% endblock form_label %} {% block widget_container_attributes_choice_widget %} {% spaceless %} id="{{ id }}" {% for attrname,attrvalue in attr %}{{attrname}}="{% if attrname == 'class' %}unstyled {% endif%}{{attrvalue}}" {% endfor %} {% if "class" not in attr %}class="unstyled"{%endif %} {% endspaceless %} {% endblock %} {% block choice_widget_expanded %} {% spaceless %}
    {% for child in form %}
  • {{ form_widget(child) }} {{ form_label(child) }}
  • {% endfor %}
{% endspaceless %} {% endblock choice_widget_expanded %} {% block choice_widget %} {% spaceless %} {% if compound %}
    {% for child in form %}
  • {% set form_widget_content %} {{ form_widget(child) }} {% endset %} {{ form_label(child, child.vars.label|default(null), { 'in_list_checkbox' : true, 'widget' : form_widget_content } ) }}
  • {% endfor %}
{% else %} {% endif %} {% endspaceless %} {% endblock choice_widget %} {% block form_row %} {% if sonata_admin is not defined or not sonata_admin_enabled or not sonata_admin.field_description %}
{{ form_label(form, label|default(null)) }}
{{ form_widget(form) }} {% if errors|length > 0 %}
{{ form_errors(form) }}
{% endif %}
{% else %}
{% block label %} {% if sonata_admin.field_description.options.name is defined %} {{ form_label(form, sonata_admin.field_description.options.name, { 'attr' : {'class' : 'control-label'} }) }} {% else %} {{ form_label(form, label|default(null), { 'attr' : {'class' : 'control-label'} }) }} {% endif %} {% endblock %} {% set has_label = sonata_admin.field_description.options.name is defined or label is not sameas(false) %}
{{ form_widget(form) }} {% if errors|length > 0 %}
{{ form_errors(form) }}
{% endif %} {% if sonata_admin.field_description.help %} {{ sonata_admin.admin.trans(sonata_admin.field_description.help, {}, sonata_admin.field_description.translationDomain)|raw }} {% endif %}
{% endif %} {% endblock form_row %} {% block collection_widget_row %} {% spaceless %}
{% if allow_delete %} {% endif %} {{ form_row(child) }}
{% endspaceless %} {% endblock %} {% block collection_widget %} {% spaceless %} {% if prototype is defined %} {% set child = prototype %} {% set attr = attr|merge({'data-prototype': block('collection_widget_row'), 'data-prototype-name': prototype.vars.name, 'class': attr.class|default('') }) %} {% endif %}
{{ form_errors(form) }} {% for child in form %} {{ block('collection_widget_row') }} {% endfor %} {{ form_rest(form) }} {% if allow_add %}
{% endif %}
{% endspaceless %} {% endblock collection_widget %} {% block sonata_type_immutable_array_widget %} {% spaceless %}
{{ form_errors(form) }} {% for key, child in form %} {{ block('sonata_type_immutable_array_widget_row') }} {% endfor %} {{ form_rest(form) }}
{% endspaceless %} {% endblock sonata_type_immutable_array_widget %} {% block sonata_type_immutable_array_widget_row %} {% spaceless %}
{{ form_label(child) }}
{{ form_widget(child) }}
{% if errors|length > 0 %}
{{ form_errors(child) }}
{% endif %}
{% endspaceless %} {% endblock %}