From fc8c05946c27c6db40dd95aab1899e3d58c8e5b1 Mon Sep 17 00:00:00 2001 From: aryaantony92 Date: Tue, 24 Oct 2023 16:34:51 +0200 Subject: [PATCH 1/9] Add example for Area Brick --- config/services.yaml | 2 + src/MyAreaBricks/Custom/Areabricks/Iframe.php | 20 ++++++++ templates/areas/iframe/view.html.twig | 46 +++++++++++++++++++ templates/content/default.html.twig | 2 +- 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 src/MyAreaBricks/Custom/Areabricks/Iframe.php create mode 100644 templates/areas/iframe/view.html.twig diff --git a/config/services.yaml b/config/services.yaml index eca63e05..d8c64b7b 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -212,3 +212,5 @@ services: # --------------------------------------------------------- App\Workflow\SupportsStrategy: ~ + App\MyAreaBricks\Custom\Areabricks\: + resource: '../src/MyAreaBricks/Custom/Areabricks/*' diff --git a/src/MyAreaBricks/Custom/Areabricks/Iframe.php b/src/MyAreaBricks/Custom/Areabricks/Iframe.php new file mode 100644 index 00000000..1102c214 --- /dev/null +++ b/src/MyAreaBricks/Custom/Areabricks/Iframe.php @@ -0,0 +1,20 @@ + +

IFrame

+
+ URL: {{ urlField }} +
+
+ Advanced Configuration +
+ Width: {{ widthField }}px (default: 100%) +
+
+ Height: {{ heightField }}px (default: 400px) +
+
+ Transparent: {{ transparentField }} (default: false) +
+ +{% else %} + {% if not urlField.isEmpty() %} + + {% set transparent = 'false' %} + {% set width = '100%' %} + {% set height = '400' %} + + {% if not widthField.isEmpty() %} + {% set width = widthField.data %} + {% endif %} + + {% if not heightField.isEmpty() %} + {% set height = heightField.data %} + {% endif %} + + {% if transparentField.isChecked() %} + {% set transparent = 'true' %} + {% endif %} + + + + {% endif %} +{% endif %} \ No newline at end of file diff --git a/templates/content/default.html.twig b/templates/content/default.html.twig index bb4f3979..613c1898 100644 --- a/templates/content/default.html.twig +++ b/templates/content/default.html.twig @@ -12,7 +12,7 @@ {{ pimcore_areablock('content', { 'allowed': ['blockquote', 'embed', 'featurette', 'gallery-carousel', 'gallery-folder', - 'gallery-single-images', 'headlines', 'horizontal-line', 'icon-teaser-row', 'image', + 'gallery-single-images', 'headlines', 'horizontal-line', 'icon-teaser-row', 'image', 'iframe', 'image-gallery', 'image-hotspot-marker', 'image-metadata', 'pdf', 'product-grid', 'product-teaser', 'standard-teaser', 'text-accordion', 'time-slider-featurette', 'video', 'wysiwyg', 'wysiwyg-with-images', 'personalized-product-teaser'] }) }} From 7a764714976a2a52a780e922eddf7bc3b1895f9d Mon Sep 17 00:00:00 2001 From: aryaantony92 Date: Tue, 24 Oct 2023 17:13:18 +0200 Subject: [PATCH 2/9] Add example for Areabrick --- .../Areabricks/{Iframe.php => Date.php} | 11 ++--- templates/areas/date/view.html.twig | 10 ++++ templates/areas/iframe/view.html.twig | 46 ------------------- templates/content/default.html.twig | 2 +- templates/default/events.html.twig | 2 +- 5 files changed, 15 insertions(+), 56 deletions(-) rename src/MyAreaBricks/Custom/Areabricks/{Iframe.php => Date.php} (51%) create mode 100644 templates/areas/date/view.html.twig delete mode 100644 templates/areas/iframe/view.html.twig diff --git a/src/MyAreaBricks/Custom/Areabricks/Iframe.php b/src/MyAreaBricks/Custom/Areabricks/Date.php similarity index 51% rename from src/MyAreaBricks/Custom/Areabricks/Iframe.php rename to src/MyAreaBricks/Custom/Areabricks/Date.php index 1102c214..d888ddc7 100644 --- a/src/MyAreaBricks/Custom/Areabricks/Iframe.php +++ b/src/MyAreaBricks/Custom/Areabricks/Date.php @@ -5,16 +5,11 @@ use Pimcore\Extension\Document\Areabrick\Attribute\AsAreabrick; use Pimcore\Extension\Document\Areabrick\AbstractTemplateAreabrick; -#[AsAreabrick(id: 'iframe')] -class Iframe extends AbstractTemplateAreabrick +#[AsAreabrick(id: 'date')] +class Date extends AbstractTemplateAreabrick { public function getName(): string { - return 'Iframe'; - } - - public function getDescription(): string - { - return 'Embed contents from other URL (websites) via iframe'; + return 'Date'; } } diff --git a/templates/areas/date/view.html.twig b/templates/areas/date/view.html.twig new file mode 100644 index 00000000..ffe69f4e --- /dev/null +++ b/templates/areas/date/view.html.twig @@ -0,0 +1,10 @@ +{% set date = pimcore_date('myDate', { + 'format': 'd.m.Y', + 'outputFormat': '%d.%m.%Y' +}) %} + +{% if editmode or not date.isEmpty() %} + +{% endif %} diff --git a/templates/areas/iframe/view.html.twig b/templates/areas/iframe/view.html.twig deleted file mode 100644 index f5f72d2c..00000000 --- a/templates/areas/iframe/view.html.twig +++ /dev/null @@ -1,46 +0,0 @@ -{% set urlField = pimcore_input('iframe_url') %} -{% set widthField = pimcore_numeric('iframe_width') %} -{% set heightField = pimcore_numeric('iframe_height') %} -{% set transparentField = pimcore_checkbox('iframe_transparent') %} - -{% if editmode %} -
-

IFrame

-
- URL: {{ urlField }} -
-
- Advanced Configuration -
- Width: {{ widthField }}px (default: 100%) -
-
- Height: {{ heightField }}px (default: 400px) -
-
- Transparent: {{ transparentField }} (default: false) -
-
-{% else %} - {% if not urlField.isEmpty() %} - - {% set transparent = 'false' %} - {% set width = '100%' %} - {% set height = '400' %} - - {% if not widthField.isEmpty() %} - {% set width = widthField.data %} - {% endif %} - - {% if not heightField.isEmpty() %} - {% set height = heightField.data %} - {% endif %} - - {% if transparentField.isChecked() %} - {% set transparent = 'true' %} - {% endif %} - - - - {% endif %} -{% endif %} \ No newline at end of file diff --git a/templates/content/default.html.twig b/templates/content/default.html.twig index 613c1898..2b99f421 100644 --- a/templates/content/default.html.twig +++ b/templates/content/default.html.twig @@ -11,7 +11,7 @@ {{ pimcore_areablock('content', { - 'allowed': ['blockquote', 'embed', 'featurette', 'gallery-carousel', 'gallery-folder', + 'allowed': ['blockquote', 'date', 'embed', 'featurette', 'gallery-carousel', 'gallery-folder', 'gallery-single-images', 'headlines', 'horizontal-line', 'icon-teaser-row', 'image', 'iframe', 'image-gallery', 'image-hotspot-marker', 'image-metadata', 'pdf', 'product-grid', 'product-teaser', 'standard-teaser', 'text-accordion', 'time-slider-featurette', 'video', 'wysiwyg', 'wysiwyg-with-images', 'personalized-product-teaser'] diff --git a/templates/default/events.html.twig b/templates/default/events.html.twig index 1a70bc29..b1704cf3 100644 --- a/templates/default/events.html.twig +++ b/templates/default/events.html.twig @@ -11,7 +11,7 @@ {% block content %} {{ pimcore_areablock('content', { - 'allowed': ['blockquote', 'embed', 'featurette', 'gallery-carousel', 'gallery-folder', + 'allowed': ['blockquote', 'embed', 'date', 'featurette', 'gallery-carousel', 'gallery-folder', 'gallery-single-images', 'headlines', 'horizontal-line', 'icon-teaser-row', 'image', 'image-hotspot-marker', 'pdf', 'product-grid', 'product-teaser', 'standard-teaser', 'text-accordion', 'time-slider-featurette', 'video', 'wysiwyg', 'wysiwyg-with-images'] From ca3b68febcb869b5c154103db2dc4b4abc956eed Mon Sep 17 00:00:00 2001 From: aryaantony92 <97134765+aryaantony92@users.noreply.github.com> Date: Tue, 24 Oct 2023 17:14:28 +0200 Subject: [PATCH 3/9] Remove iframe --- templates/content/default.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/content/default.html.twig b/templates/content/default.html.twig index 2b99f421..c335d5e5 100644 --- a/templates/content/default.html.twig +++ b/templates/content/default.html.twig @@ -12,9 +12,9 @@ {{ pimcore_areablock('content', { 'allowed': ['blockquote', 'date', 'embed', 'featurette', 'gallery-carousel', 'gallery-folder', - 'gallery-single-images', 'headlines', 'horizontal-line', 'icon-teaser-row', 'image', 'iframe', 'image-gallery', + 'gallery-single-images', 'headlines', 'horizontal-line', 'icon-teaser-row', 'image', 'image-gallery', 'image-hotspot-marker', 'image-metadata', 'pdf', 'product-grid', 'product-teaser', 'standard-teaser', 'text-accordion', 'time-slider-featurette', 'video', 'wysiwyg', 'wysiwyg-with-images', 'personalized-product-teaser'] }) }} -{% endblock %} \ No newline at end of file +{% endblock %} From 394c86503b8ba91b43a70f6beb367c0f0ebd331e Mon Sep 17 00:00:00 2001 From: aryaantony92 <97134765+aryaantony92@users.noreply.github.com> Date: Tue, 24 Oct 2023 17:15:47 +0200 Subject: [PATCH 4/9] Update default.html.twig --- templates/content/default.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/content/default.html.twig b/templates/content/default.html.twig index c335d5e5..34c185f2 100644 --- a/templates/content/default.html.twig +++ b/templates/content/default.html.twig @@ -12,7 +12,7 @@ {{ pimcore_areablock('content', { 'allowed': ['blockquote', 'date', 'embed', 'featurette', 'gallery-carousel', 'gallery-folder', - 'gallery-single-images', 'headlines', 'horizontal-line', 'icon-teaser-row', 'image', 'image-gallery', + 'gallery-single-images', 'headlines', 'horizontal-line', 'icon-teaser-row', 'image', 'image-hotspot-marker', 'image-metadata', 'pdf', 'product-grid', 'product-teaser', 'standard-teaser', 'text-accordion', 'time-slider-featurette', 'video', 'wysiwyg', 'wysiwyg-with-images', 'personalized-product-teaser'] }) }} From 9cd1596b881dc7c7cba39dc01d10c55153c46e5b Mon Sep 17 00:00:00 2001 From: aryaantony92 Date: Tue, 24 Oct 2023 17:32:40 +0200 Subject: [PATCH 5/9] Add example for Area Brick --- .../Custom/Areabricks/{Date.php => Validity.php} | 4 ++-- templates/areas/date/view.html.twig | 10 ---------- templates/areas/validity/view.html.twig | 15 +++++++++++++++ templates/content/default.html.twig | 4 ++-- templates/default/events.html.twig | 2 +- 5 files changed, 20 insertions(+), 15 deletions(-) rename src/MyAreaBricks/Custom/Areabricks/{Date.php => Validity.php} (76%) delete mode 100644 templates/areas/date/view.html.twig create mode 100644 templates/areas/validity/view.html.twig diff --git a/src/MyAreaBricks/Custom/Areabricks/Date.php b/src/MyAreaBricks/Custom/Areabricks/Validity.php similarity index 76% rename from src/MyAreaBricks/Custom/Areabricks/Date.php rename to src/MyAreaBricks/Custom/Areabricks/Validity.php index d888ddc7..719dabe2 100644 --- a/src/MyAreaBricks/Custom/Areabricks/Date.php +++ b/src/MyAreaBricks/Custom/Areabricks/Validity.php @@ -5,8 +5,8 @@ use Pimcore\Extension\Document\Areabrick\Attribute\AsAreabrick; use Pimcore\Extension\Document\Areabrick\AbstractTemplateAreabrick; -#[AsAreabrick(id: 'date')] -class Date extends AbstractTemplateAreabrick +#[AsAreabrick(id: 'validity')] +class Validity extends AbstractTemplateAreabrick { public function getName(): string { diff --git a/templates/areas/date/view.html.twig b/templates/areas/date/view.html.twig deleted file mode 100644 index ffe69f4e..00000000 --- a/templates/areas/date/view.html.twig +++ /dev/null @@ -1,10 +0,0 @@ -{% set date = pimcore_date('myDate', { - 'format': 'd.m.Y', - 'outputFormat': '%d.%m.%Y' -}) %} - -{% if editmode or not date.isEmpty() %} - -{% endif %} diff --git a/templates/areas/validity/view.html.twig b/templates/areas/validity/view.html.twig new file mode 100644 index 00000000..6888397b --- /dev/null +++ b/templates/areas/validity/view.html.twig @@ -0,0 +1,15 @@ + +{% if editmode %} + {{ pimcore_select("validity", { + "store": [ + ["one-month", "One month"], + ["three-months", "Three months"], + ["unlimited", "Unlimited"] + ], + "defaultValue" : "unlimited" + }) }} +{% else %} +

+ {{ "This is valid for" | trans }}:{{ pimcore_select("validity").getData() | trans }} +

+{% endif %} diff --git a/templates/content/default.html.twig b/templates/content/default.html.twig index 2b99f421..000d2012 100644 --- a/templates/content/default.html.twig +++ b/templates/content/default.html.twig @@ -11,10 +11,10 @@ {{ pimcore_areablock('content', { - 'allowed': ['blockquote', 'date', 'embed', 'featurette', 'gallery-carousel', 'gallery-folder', + 'allowed': ['blockquote', 'embed', 'featurette', 'gallery-carousel', 'gallery-folder', 'gallery-single-images', 'headlines', 'horizontal-line', 'icon-teaser-row', 'image', 'iframe', 'image-gallery', 'image-hotspot-marker', 'image-metadata', 'pdf', 'product-grid', 'product-teaser', 'standard-teaser', 'text-accordion', - 'time-slider-featurette', 'video', 'wysiwyg', 'wysiwyg-with-images', 'personalized-product-teaser'] + 'time-slider-featurette', 'validity', 'video', 'wysiwyg', 'wysiwyg-with-images', 'personalized-product-teaser'] }) }} {% endblock %} \ No newline at end of file diff --git a/templates/default/events.html.twig b/templates/default/events.html.twig index b1704cf3..ef7a6920 100644 --- a/templates/default/events.html.twig +++ b/templates/default/events.html.twig @@ -14,7 +14,7 @@ 'allowed': ['blockquote', 'embed', 'date', 'featurette', 'gallery-carousel', 'gallery-folder', 'gallery-single-images', 'headlines', 'horizontal-line', 'icon-teaser-row', 'image', 'image-hotspot-marker', 'pdf', 'product-grid', 'product-teaser', 'standard-teaser', 'text-accordion', - 'time-slider-featurette', 'video', 'wysiwyg', 'wysiwyg-with-images'] + 'time-slider-featurette', 'validity', 'video', 'wysiwyg', 'wysiwyg-with-images'] }) }}
From fbcc9bec7db1e6fa86aa0eef3e89a196aa115031 Mon Sep 17 00:00:00 2001 From: aryaantony92 <97134765+aryaantony92@users.noreply.github.com> Date: Tue, 24 Oct 2023 17:35:07 +0200 Subject: [PATCH 6/9] Update events.html.twig --- templates/default/events.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/default/events.html.twig b/templates/default/events.html.twig index ef7a6920..c054d14a 100644 --- a/templates/default/events.html.twig +++ b/templates/default/events.html.twig @@ -11,7 +11,7 @@ {% block content %} {{ pimcore_areablock('content', { - 'allowed': ['blockquote', 'embed', 'date', 'featurette', 'gallery-carousel', 'gallery-folder', + 'allowed': ['blockquote', 'embed', 'featurette', 'gallery-carousel', 'gallery-folder', 'gallery-single-images', 'headlines', 'horizontal-line', 'icon-teaser-row', 'image', 'image-hotspot-marker', 'pdf', 'product-grid', 'product-teaser', 'standard-teaser', 'text-accordion', 'time-slider-featurette', 'validity', 'video', 'wysiwyg', 'wysiwyg-with-images'] @@ -148,4 +148,4 @@
-{% endblock %} \ No newline at end of file +{% endblock %} From b1bf73f3410adf2dbc509685dff28cacf6b5c1ac Mon Sep 17 00:00:00 2001 From: aryaantony92 <97134765+aryaantony92@users.noreply.github.com> Date: Tue, 24 Oct 2023 17:35:39 +0200 Subject: [PATCH 7/9] Update Validity.php --- src/MyAreaBricks/Custom/Areabricks/Validity.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MyAreaBricks/Custom/Areabricks/Validity.php b/src/MyAreaBricks/Custom/Areabricks/Validity.php index 719dabe2..ab8bb3da 100644 --- a/src/MyAreaBricks/Custom/Areabricks/Validity.php +++ b/src/MyAreaBricks/Custom/Areabricks/Validity.php @@ -10,6 +10,6 @@ class Validity extends AbstractTemplateAreabrick { public function getName(): string { - return 'Date'; + return 'Validity'; } } From e006abc360927401ced6fa404c0f970967e59132 Mon Sep 17 00:00:00 2001 From: aryaantony92 <97134765+aryaantony92@users.noreply.github.com> Date: Tue, 24 Oct 2023 17:36:11 +0200 Subject: [PATCH 8/9] Update default.html.twig --- templates/content/default.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/content/default.html.twig b/templates/content/default.html.twig index bd814b97..24692162 100644 --- a/templates/content/default.html.twig +++ b/templates/content/default.html.twig @@ -12,7 +12,7 @@ {{ pimcore_areablock('content', { 'allowed': ['blockquote', 'embed', 'featurette', 'gallery-carousel', 'gallery-folder', - 'gallery-single-images', 'headlines', 'horizontal-line', 'icon-teaser-row', 'image', 'iframe', 'image-gallery', + 'gallery-single-images', 'headlines', 'horizontal-line', 'icon-teaser-row', 'image', 'image-hotspot-marker', 'image-metadata', 'pdf', 'product-grid', 'product-teaser', 'standard-teaser', 'text-accordion', 'time-slider-featurette', 'validity', 'video', 'wysiwyg', 'wysiwyg-with-images', 'personalized-product-teaser'] }) }} From b9b1e0447dbabae7a8781bd750d8be581fdc56e0 Mon Sep 17 00:00:00 2001 From: aryaantony92 <97134765+aryaantony92@users.noreply.github.com> Date: Tue, 24 Oct 2023 17:43:51 +0200 Subject: [PATCH 9/9] Update templates/areas/validity/view.html.twig Co-authored-by: robertSt7 <104770750+robertSt7@users.noreply.github.com> --- templates/areas/validity/view.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/areas/validity/view.html.twig b/templates/areas/validity/view.html.twig index 6888397b..61339579 100644 --- a/templates/areas/validity/view.html.twig +++ b/templates/areas/validity/view.html.twig @@ -10,6 +10,6 @@ }) }} {% else %}

- {{ "This is valid for" | trans }}:{{ pimcore_select("validity").getData() | trans }} + {{ "This is valid for" | trans }}: {{ pimcore_select("validity").getData() | trans }}

{% endif %}