Browse Source

Merge branch 'develop'

feature/symfony6.1
Guillaume 2 years ago
parent
commit
9800dd9e04
3 changed files with 48 additions and 37 deletions
  1. +4
    -1
      Controller/ControllerTrait.php
  2. +1
    -0
      Resources/translations/admin.fr.yaml
  3. +43
    -36
      Resources/views/adminlte/crud/form_theme.html.twig

+ 4
- 1
Controller/ControllerTrait.php View File

@@ -39,7 +39,10 @@ use Twig\Environment;

trait ControllerTrait
{
public static function getSubscribedServices()
//TODO si vous avez une erreur avec le :array c'est qu'il faut passer à symfony 5.4.
//Suivez la procédure suivante : https://symfony.com/doc/current/setup/unstable_versions.html#upgrading-your-project-to-an-unstable-symfony-version
//En gros il faut changer tout les dépendances symfony/ qui sont en 5.3 par 5.4 dans composer.json
public static function getSubscribedServices() :array
{
return array_merge(
parent::getSubscribedServices(),

+ 1
- 0
Resources/translations/admin.fr.yaml View File

@@ -27,6 +27,7 @@ title:

action:
create: Créer
close: Fermer
edit: Modifier
save: Sauvegarder
sort: Ordonner

+ 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