From bbddf7813e04f65d0ce2b1279a37a9937e403411 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 13 Mar 2023 16:18:20 +0100 Subject: [PATCH] Fix block form_row in form theme templates, comparing more cases. See this note https://gitlab.com/Chill-Projet/chill-bundles/-/merge_requests/502#note_1311993084 --- .../ChillMainBundle/Form/Type/PrivateCommentType.php | 2 +- .../bootstrap5/bootstrap_5_horizontal_layout.html.twig | 3 ++- .../Resources/views/Form/fields.html.twig | 9 ++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php b/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php index 2ab318d9c..5c29f4d42 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php @@ -39,7 +39,7 @@ class PrivateCommentType extends AbstractType $builder ->add('comments', ChillTextareaType::class, [ 'disable_editor' => $options['disable_editor'], - 'label' => false, + 'label' => $options['label'], ]) ->setDataMapper($this->dataMapper); } diff --git a/src/Bundle/ChillMainBundle/Resources/views/Form/bootstrap5/bootstrap_5_horizontal_layout.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Form/bootstrap5/bootstrap_5_horizontal_layout.html.twig index f4a2c3294..1afdbb2c9 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Form/bootstrap5/bootstrap_5_horizontal_layout.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Form/bootstrap5/bootstrap_5_horizontal_layout.html.twig @@ -68,7 +68,8 @@ {{- form_errors(form) -}} {% else %} -
+
{{- form_label(form) -}}
+
{{- form_widget(form, widget_attr) -}} {{- form_help(form) -}} {{- form_errors(form) -}} diff --git a/src/Bundle/ChillMainBundle/Resources/views/Form/fields.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Form/fields.html.twig index 5a577fecd..dfa851eed 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Form/fields.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Form/fields.html.twig @@ -56,6 +56,10 @@
{% endapply %} {% endblock form_row %} +{# + The block 'form_row' above may be removed ! + Read this note: https://gitlab.com/Chill-Projet/chill-bundles/-/merge_requests/502#note_1311993084 +#} {% block choice_widget_expanded %} {% apply spaceless %} @@ -201,7 +205,6 @@ {% block private_comment_row %} - {{ form_label(form) }} {{ form_row(form) }} {% endblock %} @@ -211,6 +214,10 @@ {% endfor %} {% endblock %} +{% block comment_row %} + {{ form_row(form) }} +{% endblock %} + {% block comment_widget %} {% for entry in form %} {{ form_widget(entry) }}