From f2804008f08c2ef1f678d3fbedaf6656e6edcf46 Mon Sep 17 00:00:00 2001 From: Jan Rosier Date: Sat, 16 Aug 2025 17:43:58 +0200 Subject: [PATCH] Use bootstrap 5 form theme --- config/packages/twig.yaml | 5 ++--- templates/form/layout.html.twig | 16 ---------------- tests/Controller/Admin/BlogControllerTest.php | 5 ++++- 3 files changed, 6 insertions(+), 20 deletions(-) delete mode 100644 templates/form/layout.html.twig diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index 3c418aa64..938b1d1ca 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -1,9 +1,8 @@ twig: - default_path: '%kernel.project_dir%/templates' + file_name_pattern: '*.twig' form_themes: - - 'form/layout.html.twig' + - 'bootstrap_5_layout.html.twig' - 'form/fields.html.twig' - file_name_pattern: '*.twig' when@test: twig: diff --git a/templates/form/layout.html.twig b/templates/form/layout.html.twig deleted file mode 100644 index c51b973d8..000000000 --- a/templates/form/layout.html.twig +++ /dev/null @@ -1,16 +0,0 @@ -{% extends 'bootstrap_4_layout.html.twig' %} - -{# Errors #} - -{# {% block form_errors -%} - {% if errors|length > 0 -%} - {% if form is not rootform %}{% else %}
{% endif %} -
    - {%- for error in errors -%} - {# use font-awesome icon library # } -
  • {{ error.message }}
  • - {%- endfor -%} -
- {% if form is not rootform %}{% else %}
{% endif %} - {%- endif %} -{%- endblock form_errors %} #} diff --git a/tests/Controller/Admin/BlogControllerTest.php b/tests/Controller/Admin/BlogControllerTest.php index 01649b75a..d7a2c39cc 100644 --- a/tests/Controller/Admin/BlogControllerTest.php +++ b/tests/Controller/Admin/BlogControllerTest.php @@ -133,8 +133,11 @@ public function testAdminNewDuplicatedPost(): void // post titles must be unique, so trying to create the same post twice should result in an error $this->client->submit($form); - $this->assertSelectorTextContains('form .invalid-feedback .form-error-message', 'This title was already used in another blog post, but they must be unique.'); $this->assertSelectorExists('form #post_title.is-invalid'); + $this->assertSelectorTextContains( + 'form .invalid-feedback', + 'This title was already used in another blog post, but they must be unique.' + ); } public function testAdminShowPost(): void