From 4365242a207d0bbd62bd908b5b20461ec7206347 Mon Sep 17 00:00:00 2001 From: Michael Albrecht Date: Sat, 21 Jan 2023 23:40:46 +0100 Subject: [PATCH 1/7] add editor-config-bundle and make fragment configuration more simple --- .../Base/AbstractConfigurableAreabrick.php | 48 +++++++++++++++++++ DocumentAreabrick/Code.php | 4 +- DocumentAreabrick/Header.php | 4 +- DocumentAreabrick/Image.php | 4 +- DocumentAreabrick/Textarea.php | 4 +- DocumentAreabrick/Wysiwyg.php | 4 +- Resources/views/Areas/fragmentWrap.html.twig | 42 ---------------- composer.json | 9 +++- 8 files changed, 66 insertions(+), 53 deletions(-) create mode 100644 DocumentAreabrick/Base/AbstractConfigurableAreabrick.php diff --git a/DocumentAreabrick/Base/AbstractConfigurableAreabrick.php b/DocumentAreabrick/Base/AbstractConfigurableAreabrick.php new file mode 100644 index 0000000..25bad2b --- /dev/null +++ b/DocumentAreabrick/Base/AbstractConfigurableAreabrick.php @@ -0,0 +1,48 @@ + */ + use HasDialogBox; + + protected function createDialogBoxBuilder(Editable $area, ?Info $info): DialogBoxBuilder + { + return new DialogBoxBuilder(); + } + + protected function buildDialogBox(DialogBoxBuilder $dialogBox, Editable $area, ?Info $info): void + { + $dialogBox + ->addTab('Fragment Settings', + $dialogBox->createSelect( + 'fragment-style', + [ + 'none' => 'none', + 'fade-in' => 'fade in', + 'fade-out' => 'fade out', + 'fade-up' => 'fade up', + 'fade-in-then-out' => 'fade in then out', + 'fade-in-then-semi-out' => 'fade in then semi out', + 'grow' => 'grow', + 'shrink' => 'shrink', + 'strike' => 'strike', + 'highlight-current-blue' => 'highlight current blue', + 'highlight-red' => 'highlight red', + 'highlight-blue' => 'highlight blue', + 'highlight-green' => 'highlight green', + ] + ) + ->setLabel('Fragments Style') + ->setDefaultValue('none'), + $dialogBox->createNumeric('fragments-order', 0, 20), + ); + } + + +} \ No newline at end of file diff --git a/DocumentAreabrick/Code.php b/DocumentAreabrick/Code.php index d133fd9..916ee76 100644 --- a/DocumentAreabrick/Code.php +++ b/DocumentAreabrick/Code.php @@ -2,9 +2,9 @@ namespace Neusta\Pimcore\PresentationBundle\DocumentAreabrick; -use Pimcore\Extension\Document\Areabrick\AbstractTemplateAreabrick; +use Neusta\Pimcore\PresentationBundle\DocumentAreabrick\Base\AbstractConfigurableAreabrick; -class Code extends AbstractTemplateAreabrick +class Code extends AbstractConfigurableAreabrick { public function getName(): string { diff --git a/DocumentAreabrick/Header.php b/DocumentAreabrick/Header.php index eda18d0..aa1d0a1 100644 --- a/DocumentAreabrick/Header.php +++ b/DocumentAreabrick/Header.php @@ -2,9 +2,9 @@ namespace Neusta\Pimcore\PresentationBundle\DocumentAreabrick; -use Pimcore\Extension\Document\Areabrick\AbstractTemplateAreabrick; +use Neusta\Pimcore\PresentationBundle\DocumentAreabrick\Base\AbstractConfigurableAreabrick; -class Header extends AbstractTemplateAreabrick +class Header extends AbstractConfigurableAreabrick { public function getName(): string { diff --git a/DocumentAreabrick/Image.php b/DocumentAreabrick/Image.php index 66541bb..948a805 100644 --- a/DocumentAreabrick/Image.php +++ b/DocumentAreabrick/Image.php @@ -2,9 +2,9 @@ namespace Neusta\Pimcore\PresentationBundle\DocumentAreabrick; -use Pimcore\Extension\Document\Areabrick\AbstractTemplateAreabrick; +use Neusta\Pimcore\PresentationBundle\DocumentAreabrick\Base\AbstractConfigurableAreabrick; -class Image extends AbstractTemplateAreabrick +class Image extends AbstractConfigurableAreabrick { public function getName(): string { diff --git a/DocumentAreabrick/Textarea.php b/DocumentAreabrick/Textarea.php index f15a393..7d4d3f7 100644 --- a/DocumentAreabrick/Textarea.php +++ b/DocumentAreabrick/Textarea.php @@ -2,9 +2,9 @@ namespace Neusta\Pimcore\PresentationBundle\DocumentAreabrick; -use Pimcore\Extension\Document\Areabrick\AbstractTemplateAreabrick; +use Neusta\Pimcore\PresentationBundle\DocumentAreabrick\Base\AbstractConfigurableAreabrick; -class Textarea extends AbstractTemplateAreabrick +class Textarea extends AbstractConfigurableAreabrick { public function getName(): string { diff --git a/DocumentAreabrick/Wysiwyg.php b/DocumentAreabrick/Wysiwyg.php index 3f0065e..bb1fe10 100644 --- a/DocumentAreabrick/Wysiwyg.php +++ b/DocumentAreabrick/Wysiwyg.php @@ -2,9 +2,9 @@ namespace Neusta\Pimcore\PresentationBundle\DocumentAreabrick; -use Pimcore\Extension\Document\Areabrick\AbstractTemplateAreabrick; +use Neusta\Pimcore\PresentationBundle\DocumentAreabrick\Base\AbstractConfigurableAreabrick; -class Wysiwyg extends AbstractTemplateAreabrick +class Wysiwyg extends AbstractConfigurableAreabrick { public function getName(): string { diff --git a/Resources/views/Areas/fragmentWrap.html.twig b/Resources/views/Areas/fragmentWrap.html.twig index b69c100..f31eb3f 100644 --- a/Resources/views/Areas/fragmentWrap.html.twig +++ b/Resources/views/Areas/fragmentWrap.html.twig @@ -7,45 +7,3 @@ {% set isFragment = fragmentStyle ? 'fragment' : '' %} - -
- {% block brick %}{% endblock %} -
- -{% if editmode %} -
-

Brick settings

- -
-
-

Fragments style

- {{ pimcore_select('fragment-style',{ - 'store': [ - ['none', 'none'], - ['fade-in', 'fade in'], - ['fade-out', 'fade out'], - ['fade-up', 'fade up'], - ['fade-in-then-out', 'fade in then out'], - ['fade-in-then-semi-out', 'fade in then semi out'], - ['grow', 'grow'], - ['shrink', 'shrink'], - ['strike', 'strike'], - ['highlight-current-blue', 'highlight current blue'], - ['highlight-red', 'highlight red'], - ['highlight-blue', 'highlight blue'], - ['highlight-green', 'highlight green'], - ], - 'defaultValue': 'none' - }) }} -
- -
-

Fragments order

- {{ pimcore_numeric('fragment-order', { - 'minValue': 0, - 'maxValue': 20 - }) }} -
-
-
-{% endif %} diff --git a/composer.json b/composer.json index 9e07bbf..a7a0b0c 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,12 @@ "role": "Developer" } ], + "repositories": { + "pimcore-editorconfig-bundle": { + "type": "git", + "url": "https://github.com/teamneusta/pimcore-editorconfig-bundle.git" + } + }, "require": { "php": "^8.1", "pimcore/pimcore": "^10.0", @@ -19,7 +25,8 @@ "symfony/dependency-injection": "^5.3", "symfony/event-dispatcher": "^5.2", "symfony/finder": "^5.2", - "symfony/http-kernel": "^5.3" + "symfony/http-kernel": "^5.3", + "teamneusta/pimcore-editorconfig-bundle": "dev-main" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.12", From ad672d1d2ebbc24b4f0abef45de13bc402c573f8 Mon Sep 17 00:00:00 2001 From: Michael Albrecht Date: Sat, 21 Jan 2023 23:46:37 +0100 Subject: [PATCH 2/7] use WIP version of editor-config-bundle (atm) --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a7a0b0c..39382ee 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "symfony/event-dispatcher": "^5.2", "symfony/finder": "^5.2", "symfony/http-kernel": "^5.3", - "teamneusta/pimcore-editorconfig-bundle": "dev-main" + "teamneusta/pimcore-editorconfig-bundle": "dev-feature/new-type-numeric-value" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.12", From 4a861a5d1524b379bd3ca6e2c46e92201fcb960e Mon Sep 17 00:00:00 2001 From: Michael Albrecht Date: Sat, 21 Jan 2023 23:50:06 +0100 Subject: [PATCH 3/7] add missing use statements --- DocumentAreabrick/Base/AbstractConfigurableAreabrick.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DocumentAreabrick/Base/AbstractConfigurableAreabrick.php b/DocumentAreabrick/Base/AbstractConfigurableAreabrick.php index 25bad2b..0b496da 100644 --- a/DocumentAreabrick/Base/AbstractConfigurableAreabrick.php +++ b/DocumentAreabrick/Base/AbstractConfigurableAreabrick.php @@ -3,6 +3,8 @@ namespace Neusta\Pimcore\PresentationBundle\DocumentAreabrick\Base; use Neusta\Pimcore\EditorConfigBundle\Document\EditableDialogBox\DialogBoxBuilder; +use Pimcore\Extension\Document\Areabrick\AbstractTemplateAreabrick; +use Pimcore\Extension\Document\Areabrick\EditableDialogBoxInterface; use Pimcore\Model\Document\Editable; use Pimcore\Model\Document\Editable\Area\Info; From a4c61a0b7f09896a91638a3bda74c997eac1ee9b Mon Sep 17 00:00:00 2001 From: Michael Albrecht Date: Sat, 21 Jan 2023 23:51:41 +0100 Subject: [PATCH 4/7] add missing use statements --- DocumentAreabrick/Base/AbstractConfigurableAreabrick.php | 1 + 1 file changed, 1 insertion(+) diff --git a/DocumentAreabrick/Base/AbstractConfigurableAreabrick.php b/DocumentAreabrick/Base/AbstractConfigurableAreabrick.php index 0b496da..1ffccc5 100644 --- a/DocumentAreabrick/Base/AbstractConfigurableAreabrick.php +++ b/DocumentAreabrick/Base/AbstractConfigurableAreabrick.php @@ -2,6 +2,7 @@ namespace Neusta\Pimcore\PresentationBundle\DocumentAreabrick\Base; +use Neusta\Pimcore\EditorConfigBundle\Document\Base\HasDialogBox; use Neusta\Pimcore\EditorConfigBundle\Document\EditableDialogBox\DialogBoxBuilder; use Pimcore\Extension\Document\Areabrick\AbstractTemplateAreabrick; use Pimcore\Extension\Document\Areabrick\EditableDialogBoxInterface; From 8be50ff111f73622fabcb65c059d5caf9c6caee8 Mon Sep 17 00:00:00 2001 From: Michael Albrecht Date: Sun, 22 Jan 2023 00:12:22 +0100 Subject: [PATCH 5/7] small cs fixes --- src/DocumentAreabrick/Base/AbstractConfigurableAreabrick.php | 4 +--- src/DocumentAreabrick/Textarea.php | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/DocumentAreabrick/Base/AbstractConfigurableAreabrick.php b/src/DocumentAreabrick/Base/AbstractConfigurableAreabrick.php index 1ffccc5..e9b3ccd 100644 --- a/src/DocumentAreabrick/Base/AbstractConfigurableAreabrick.php +++ b/src/DocumentAreabrick/Base/AbstractConfigurableAreabrick.php @@ -46,6 +46,4 @@ protected function buildDialogBox(DialogBoxBuilder $dialogBox, Editable $area, ? $dialogBox->createNumeric('fragments-order', 0, 20), ); } - - -} \ No newline at end of file +} diff --git a/src/DocumentAreabrick/Textarea.php b/src/DocumentAreabrick/Textarea.php index fd352ac..49a3d48 100644 --- a/src/DocumentAreabrick/Textarea.php +++ b/src/DocumentAreabrick/Textarea.php @@ -4,7 +4,7 @@ use Neusta\Pimcore\PresentationBundle\DocumentAreabrick\Base\AbstractConfigurableAreabrick; -class Textarea extends AbstractConfigurableAreabrick +class Textarea extends AbstractConfigurableAreabrick { public function getName(): string { From 8cf9e889e93db771e1f5f7794d1d27cd2724033e Mon Sep 17 00:00:00 2001 From: Nils Weigel Date: Tue, 31 Jan 2023 15:15:19 +0100 Subject: [PATCH 6/7] areabrick config bundle: do not use custom repo, use dev-main --- composer.json | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/composer.json b/composer.json index f151ea6..c744d6c 100644 --- a/composer.json +++ b/composer.json @@ -11,12 +11,6 @@ "role": "Developer" } ], - "repositories": { - "pimcore-editorconfig-bundle": { - "type": "git", - "url": "https://github.com/teamneusta/pimcore-editorconfig-bundle.git" - } - }, "require": { "php": "^8.1", "pimcore/pimcore": "^10.0", @@ -26,7 +20,7 @@ "symfony/event-dispatcher": "^5.2", "symfony/finder": "^5.2", "symfony/http-kernel": "^5.3", - "teamneusta/pimcore-editorconfig-bundle": "dev-feature/new-type-numeric-value" + "teamneusta/pimcore-areabrick-config-bundle": "dev-main" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.11", From 27b93777b5a0592d406faa40ed0ea1323a60b8b6 Mon Sep 17 00:00:00 2001 From: Nils Weigel Date: Tue, 31 Jan 2023 15:15:30 +0100 Subject: [PATCH 7/7] fixed namespaces --- .../Base/AbstractConfigurableAreabrick.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DocumentAreabrick/Base/AbstractConfigurableAreabrick.php b/src/DocumentAreabrick/Base/AbstractConfigurableAreabrick.php index e9b3ccd..2b08abb 100644 --- a/src/DocumentAreabrick/Base/AbstractConfigurableAreabrick.php +++ b/src/DocumentAreabrick/Base/AbstractConfigurableAreabrick.php @@ -1,9 +1,9 @@ -