From ef3b41fa90d7f813fd22b31851fc515da1d19e62 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 7 Mar 2023 10:54:36 +0100 Subject: [PATCH] Fixed template horizontal form theme for ckeditor comments fields with fullWidth parameter Notes: The 'fullwidth' parameter allow to force enlarge textarea ckeditor field, escaping horizontal bootstrap theme position rule (4/12 - 8/12) --- .../ChillMainBundle/Form/Type/CommentType.php | 7 +- .../Form/Type/ScopePickerType.php | 7 +- .../Resources/views/Form/fields.html.twig | 64 +++++++++---------- 3 files changed, 32 insertions(+), 46 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Form/Type/CommentType.php b/src/Bundle/ChillMainBundle/Form/Type/CommentType.php index 9b8fc4701..542a429c6 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/CommentType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/CommentType.php @@ -56,12 +56,7 @@ class CommentType extends AbstractType public function buildView(FormView $view, FormInterface $form, array $options) { - $view->vars = array_replace( - $view->vars, - [ - 'fullWidth' => true, - ] - ); + $view->vars['fullWidth'] = true; } public function configureOptions(OptionsResolver $resolver) diff --git a/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php b/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php index f65677dc7..79ed6df40 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php @@ -95,12 +95,7 @@ class ScopePickerType extends AbstractType public function buildView(FormView $view, FormInterface $form, array $options) { - $view->vars = array_replace( - $view->vars, - [ - 'fullWidth' => true, - ] - ); + $view->vars['fullWidth'] = true; } public function configureOptions(OptionsResolver $resolver) diff --git a/src/Bundle/ChillMainBundle/Resources/views/Form/fields.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Form/fields.html.twig index 15d7625dd..83958b22e 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Form/fields.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Form/fields.html.twig @@ -18,41 +18,42 @@ {% block form_row %} {% apply spaceless %} - {% if form.vars.fullWidth is not defined or form.vars.fullWidth == false %}
-
+ {% if attr.class is not defined or ('cf-title' not in attr.class and 'cf-fields' not in attr.class ) %} + {{ form_label(form) }} {% endif %} - {% endapply %}"> - {% if attr.class is not defined or ('cf-title' not in attr.class and 'cf-fields' not in attr.class ) %} - {{ form_label(form) }} +
+
+ {{ form_widget(form) }} + {{ form_errors(form) }} +
+ {% else %} +
{{ form_label(form) }}
+
{{ form_widget(form) }}
{% endif %} -
-
- {{ form_widget(form) }} - {{ form_errors(form) }} -
- {% else %} - {{ form_widget(form) }} - {% endif %} {% endapply %} {% endblock form_row %} @@ -210,11 +211,6 @@ {% endfor %} {% endblock %} -{% block comment_row %} - {{ form_label(form) }} - {{ form_row(form) }} -{% endblock %} - {% block comment_widget %} {% for entry in form %} {{ form_widget(entry) }}