{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #} {% use '@EasyAdmin/symfony-form-themes/bootstrap_5_layout.html.twig' %} {% block form_start %} {% if form.vars.errors|length > 0 and 'ea_crud' in form.vars.block_prefixes|default([]) %} {{ form_errors(form, {attr: { class: 'global-invalid-feedback' }}) }} {% endif %} {{ parent() }}
{# this is closed in form_end #} {% endblock form_start %} {% block form_end %} {% if not render_rest is defined or render_rest %} {{ form_rest(form) }} {% endif %}
{# this closes the '
' of form_start #} {% endblock %} {% block form_errors %} {% if errors|length > 0 %} {% for error in errors %}
{{ error.message }}
{% endfor %} {% endif %} {% endblock form_errors %} {# Widgets #} {% block form_widget_simple -%} {% if type is not defined or type not in ['file', 'hidden'] %} {%- set attr = attr|merge({class: (attr.class|default(''))|trim}) -%} {% endif %} {%- if type is defined and (type == 'range' or type == 'color') %} {# Attribute "required" is not supported #} {%- set required = false -%} {% endif %} {{- parent() -}} {%- endblock form_widget_simple %} {% block datetime_widget %} {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) %} {{ parent() }} {% endblock datetime_widget %} {% block date_widget -%}
{{- parent() -}}
{%- endblock date_widget %} {% block time_widget -%}
{{- parent() -}}
{%- endblock time_widget %} {% block file_widget -%} {% if vich|default(false) %} {%- set type = type|default('file') -%} {{- block('form_widget_simple') -}} {% else %} {{- block('form_widget_simple') -}} {% endif %} {%- endblock %} {# Rows #} {% block form_row %} {% set row_attr = row_attr|merge({ class: row_attr.class|default('') ~ ' form-group' }) %}
{{- form_label(form) -}}
{% set has_prepend_html = ea.field.prepend_html|default(null) is not null %} {% set has_append_html = ea.field.append_html|default(null) is not null %} {% set has_input_groups = has_prepend_html or has_append_html %} {% if has_input_groups %}
{% endif %} {% if has_prepend_html %}
{{ ea.field.prepend_html|raw }}
{% endif %} {{ form_widget(form) }} {% if has_append_html %} {{ ea.field.append_html|raw }} {% endif %} {% if has_input_groups %}
{% endif %} {% set nullable_fields_fqcn = [ 'EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField', 'EasyCorp\Bundle\EasyAdminBundle\Field\DateField', 'EasyCorp\Bundle\EasyAdminBundle\Field\TimeField', ] %} {% if form.vars.ea_crud_form.ea_field.fieldFqcn|default(false) in nullable_fields_fqcn and ea.field.nullable|default(false) %}
{% endif %} {% if ea.field.help ?? false %} {{ ea.field.help|raw }} {% elseif form.vars.help ?? false %} {{ form.vars.help|trans(form.vars.help_translation_parameters, form.vars.translation_domain)|raw }} {% endif %} {{- form_errors(form) -}}
{# if a field doesn't define its columns explicitly, insert a fill element to make the field take the entire row space #} {% if form.vars.ea_crud_form.ea_field.columns|default(null) is null %}
{% endif %} {% endblock form_row %} {% block choice_widget_collapsed %} {% if 'ea-autocomplete' == attr['data-ea-widget']|default(false) %} {% set attr = attr|merge({ 'data-ea-i18n-no-results-found': 'autocomplete.no-results-found'|trans({}, 'EasyAdminBundle'), 'data-ea-i18n-no-more-results': 'autocomplete.no-more-results'|trans({}, 'EasyAdminBundle'), 'data-ea-i18n-loading-more-results': 'autocomplete.loading-more-results'|trans({}, 'EasyAdminBundle'), }) %} {% endif %} {{ parent() }} {% endblock choice_widget_collapsed %} {% block collection_row %} {% if prototype is defined and not prototype.rendered %} {% set row_attr = row_attr|merge({ 'data-prototype': form_row(prototype) }) %} {% endif %} {% set row_attr = row_attr|merge({ 'data-ea-collection-field': 'true', 'data-entry-is-complex': form.vars.ea_crud_form.ea_field and form.vars.ea_crud_form.ea_field.customOptions.get('entryIsComplex') ? 'true' : 'false', 'data-allow-add': allow_add ? 'true' : 'false', 'data-allow-delete': allow_delete ? 'true' : 'false', 'data-num-items': form.children is empty ? 0 : max(form.children|keys), 'data-form-type-name-placeholder': prototype is defined ? prototype.vars.name : '', }) %} {{ block('form_row') }} {% endblock collection_row %} {% block collection_widget %} {# the "is iterable" check is needed because if an object implements __toString() and returns an empty string, "is empty" returns true even if it's not a collection #} {% set isEmptyCollection = value is null or (value is iterable and value is empty) %} {% set is_array_field = 'EasyCorp\\Bundle\\EasyAdminBundle\\Field\\ArrayField' == form.vars.ea_crud_form.ea_field.fieldFqcn ?? false %}
{% if isEmptyCollection %} {{ block('empty_collection') }} {% elseif is_array_field %} {{ block('form_widget') }} {% else %}
{{ block('form_widget') }}
{% endif %}
{% if isEmptyCollection or form.vars.prototype is defined %} {% set attr = attr|merge({'data-empty-collection': block('empty_collection') }) %} {% endif %} {% if allow_add|default(false) %} {% endif %} {% endblock collection_widget %} {% block collection_entry_widget %} {% set is_array_field = 'EasyCorp\\Bundle\\EasyAdminBundle\\Field\\ArrayField' == form_parent(form).vars.ea_crud_form.ea_field.fieldFqcn ?? false %} {% set is_complex = form_parent(form).vars.ea_crud_form.ea_field.customOptions.get('entryIsComplex') ?? false %} {% set allows_deleting_items = form_parent(form).vars.allow_delete|default(false) %} {% set render_expanded = form_parent(form).vars.ea_crud_form.ea_field.customOptions.get('renderExpanded') ?? false %} {% set delete_item_button %} {% endset %}
{% if is_array_field|default(false) %} {{ form_widget(form) }} {% if allows_deleting_items %} {{ delete_item_button }} {% endif %} {% else %}

{% if allows_deleting_items %} {{ delete_item_button }} {% endif %}

{{ form_widget(form) }}
{% endif %}
{% endblock collection_entry_widget %} {% block form_widget_compound %}
{% if 'collection' in block_prefixes %} {# the "is iterable" check is needed because if an object implements __toString() and returns an empty string, "is empty" returns true even if it's not a collection #} {% set isEmptyCollection = value is null or (value is iterable and value is empty) %} {% if isEmptyCollection %} {{ block('empty_collection') }} {% endif %} {% if isEmptyCollection or form.vars.prototype is defined %} {% set attr = attr|merge({'data-empty-collection': block('empty_collection') }) %} {% endif %} {% endif %} {{ parent() }}
{% endblock form_widget_compound %} {% block button_row -%}
{{- form_widget(form) -}}
{%- endblock button_row %} {# Labels #} {% block form_label -%} {% if label is same as(false) -%}