Browse Source

Switch symfony 5.4

feature/symfony6.1
Fabien Normand 2 years ago
parent
commit
2f8f81d9dd
1 changed files with 43 additions and 36 deletions
  1. +43
    -36
      Resources/views/adminlte/crud/form_theme.html.twig

+ 43
- 36
Resources/views/adminlte/crud/form_theme.html.twig View File

@@ -23,6 +23,13 @@
value="{% if ea is defined %}{{ ea.request.query.get('referrer') }}{% endif %}">
{% endblock form_start %}

{% block form_end %}
{% if not render_rest is defined or render_rest %}
{{ form_rest(form) }}
{% endif %}
</form>
{% endblock %}

{% block form_row %}
{% set row_attr = row_attr|merge({
class: row_attr.class|default('') ~ ' form-group'
@@ -93,47 +100,47 @@

{% block form_label -%}

{% if label is same as(false) -%}
<label>{# the empty <label> is needed to not break the form design #}</label>
{%- else -%}
{%- 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-control-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,
}) %}
{% if label is same as(false) -%}
<label>{# the empty <label> is needed to not break the form design #}</label>
{%- else -%}
{# {% set label = name|humanize %} #}
{%- endif -%}
{%- endif -%}
{%- 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-control-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 -%}

{% set entityNameOrObject = form.parent.vars.data %}
{% set entityNameOrObject = form.parent.vars.data %}

{% if form.parent.vars.translation_entity_name is defined %}
{% set entityNameOrObject = form.parent.vars.translation_entity_name %}
{% endif %}
{% if form.parent.vars.translation_entity_name is defined %}
{% set entityNameOrObject = form.parent.vars.translation_entity_name %}
{% endif %}

{#
{% if not entityNameOrObject and form.parent.vars.errors.form.config.dataClass is defined %}
{% set entityNameOrObject = form.parent.vars.errors.form.config.dataClass %}
{% endif %}
#}
{#
{% if not entityNameOrObject and form.parent.vars.errors.form.config.dataClass is defined %}
{% set entityNameOrObject = form.parent.vars.errors.form.config.dataClass %}
{% endif %}
#}

<{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}
>{{ (label is not empty and '.' in label) ? label|trans({}, translation_domain) : name|sov_trans_admin_field(entityNameOrObject) }}
</{{ element|default('label') }}>
<{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}
>{{ (label is not empty and '.' in label) ? label|trans({}, translation_domain) : name|sov_trans_admin_field(entityNameOrObject) }}
</{{ element|default('label') }}>

{%- endif -%}
{%- endblock form_label %}
{%- endif -%}
{%- endblock form_label %}

{% block gallery_manager_row %}
{{ block('collection_row') }}
@@ -261,7 +268,7 @@
{% endblock file_manager_widget %}

{% block checkbox_radio_label -%}
{#- Do not display the label if widget is not defined in order to prevent double label rendering -#}
{#- Do not display the label if widget is not defined in order to prevent double label rendering -#}
{%- if widget is defined -%}
{% set is_parent_custom = parent_label_class is defined and ('checkbox-custom' in parent_label_class or 'radio-custom' in parent_label_class or 'switch-custom' in parent_label_class) %}
{% set is_custom = label_attr.class is defined and ('checkbox-custom' in label_attr.class or 'radio-custom' in label_attr.class or 'switch-custom' in label_attr.class) %}

Loading…
Cancel
Save