From 10f78b71bbd05b071813c63eadb65e9148879e76 Mon Sep 17 00:00:00 2001 From: Oleh Boiko Date: Sat, 21 Dec 2024 13:58:21 +0200 Subject: [PATCH] [Feature] Bootstrap 5 layout support --- README.md | 8 +++++++- config/install/translations/admin.csv | 4 +++- config/pimcore/config.yaml | 10 +++++++++- .../Functional/SimpleForm/SimpleFormEditWindowCest.php | 8 ++++++++ tests/Unit/Config/TemplateTest.php | 4 +++- 5 files changed, 30 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index deb366e4..f6cc670e 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,12 @@ ## Installation +```bash +composer require "dachcom-digital/formbuilder":"~5.1.4" +``` + +OR add to `composer.json`: + ```json "require" : { "dachcom-digital/formbuilder" : "~5.1.0" @@ -93,7 +99,7 @@ Nothing to tell here, it's just [Symfony](https://symfony.com/doc/current/templa - [Frontend Tips](docs/90_FrontendTips.md) - [FormBuilder Javascript Plugins](docs/91_Javascript.md) - [Configuration Flags](docs/100_ConfigurationFlags.md) - +- [Custom form templates](docs/110_CustomTemplates.md) ## Upgrade Info Before updating, please [check our upgrade notes!](UPGRADE.md) diff --git a/config/install/translations/admin.csv b/config/install/translations/admin.csv index 9185a64f..4e53db26 100644 --- a/config/install/translations/admin.csv +++ b/config/install/translations/admin.csv @@ -124,6 +124,8 @@ "form_builder_form_template.bootstrap_3_layout","Bootstrap 3 Layout","Bootstrap 3 Layout" "form_builder_form_template.bootstrap_4_horizontal_layout","Bootstrap 4 Horizontal Layout","Bootstrap 4 Horizontales Layout" "form_builder_form_template.bootstrap_4_layout","Bootstrap 4 Layout","Bootstrap 4 Layout" +"form_builder_form_template.bootstrap_5_horizontal_layout","Bootstrap 5 Horizontal Layout","Bootstrap 5 Horizontales Layout" +"form_builder_form_template.bootstrap_5_layout","Bootstrap 5 Layout","Bootstrap 5 Layout" "form_builder_form_template.form_div_layout","Form Div Layout","Form Div Layout" "form_builder_type_container.repeater.option.min","Minimum","Minimum" "form_builder_type_container.repeater.option.max","Maximum","Maximum" @@ -145,4 +147,4 @@ "form_builder.output_workflow.channel.email","Email Channel", "E-Mail Channel" "form_builder.output_workflow.channel.object","Object Channel", "Object Channel" "form_builder.output_workflow.channel.api","API Channel", "API Channel" -"form_builder.output_workflow.channel.funnel","Funnel Layer", "Funnel Layer" \ No newline at end of file +"form_builder.output_workflow.channel.funnel","Funnel Layer", "Funnel Layer" diff --git a/config/pimcore/config.yaml b/config/pimcore/config.yaml index 2e45379e..788fbe48 100644 --- a/config/pimcore/config.yaml +++ b/config/pimcore/config.yaml @@ -73,6 +73,14 @@ form_builder: value: 'bootstrap_4_horizontal_layout.html.twig' label: 'form_builder_form_template.bootstrap_4_horizontal_layout' default: false + bootstrap_5_layout: + value: 'bootstrap_5_layout.html.twig' + label: 'form_builder_form_template.bootstrap_5_layout' + default: false + bootstrap_5_horizontal_layout: + value: 'bootstrap_5_horizontal_layout.html.twig' + label: 'form_builder_form_template.bootstrap_5_horizontal_layout' + default: false field: templates: default: @@ -241,4 +249,4 @@ form_builder: imports: - { resource: '../backend/base_config.yaml' } - { resource: '../types/field_types.yaml' } - - { resource: '../types/container_types.yaml' } \ No newline at end of file + - { resource: '../types/container_types.yaml' } diff --git a/tests/Functional/SimpleForm/SimpleFormEditWindowCest.php b/tests/Functional/SimpleForm/SimpleFormEditWindowCest.php index 448c50a3..50bbfb6a 100644 --- a/tests/Functional/SimpleForm/SimpleFormEditWindowCest.php +++ b/tests/Functional/SimpleForm/SimpleFormEditWindowCest.php @@ -69,6 +69,14 @@ public function testConfigFieldFormTemplateSelector(FunctionalTester $I) 0 => 'bootstrap_4_horizontal_layout.html.twig', 1 => 'Bootstrap 4 Horizontal Layout', ], + 5 => [ + 0 => 'bootstrap_5_layout.html.twig', + 1 => 'Bootstrap 5 Layout', + ], + 6 => [ + 0 => 'bootstrap_5_horizontal_layout.html.twig', + 1 => 'Bootstrap 5 Horizontal Layout', + ], ], ]; diff --git a/tests/Unit/Config/TemplateTest.php b/tests/Unit/Config/TemplateTest.php index 4ef814c7..ba895428 100644 --- a/tests/Unit/Config/TemplateTest.php +++ b/tests/Unit/Config/TemplateTest.php @@ -25,7 +25,9 @@ public function testFormTemplatesConfig() $this->assertArrayHasKey('bootstrap_3_horizontal_layout', $formConfig['templates']); $this->assertArrayHasKey('bootstrap_4_layout', $formConfig['templates']); $this->assertArrayHasKey('bootstrap_4_horizontal_layout', $formConfig['templates']); - $this->assertCount(5, $formConfig['templates']); + $this->assertArrayHasKey('bootstrap_5_layout', $formConfig['templates']); + $this->assertArrayHasKey('bootstrap_5_horizontal_layout', $formConfig['templates']); + $this->assertCount(7, $formConfig['templates']); } public function testFormFieldTemplates()