Skip to content

Commit

Permalink
Add example for Area Brick (#552)
Browse files Browse the repository at this point in the history
* Add example for Area Brick

* Add example for Areabrick

* Remove iframe

* Update default.html.twig

* Add example for Area Brick

* Update events.html.twig

* Update Validity.php

* Update default.html.twig

* Update templates/areas/validity/view.html.twig

Co-authored-by: robertSt7 <104770750+robertSt7@users.noreply.github.com>

---------

Co-authored-by: robertSt7 <104770750+robertSt7@users.noreply.github.com>
  • Loading branch information
aryaantony92 and robertSt7 committed Oct 24, 2023
1 parent 4fea4ca commit 9acc781
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 4 deletions.
2 changes: 2 additions & 0 deletions config/services.yaml
Expand Up @@ -212,3 +212,5 @@ services:
# ---------------------------------------------------------
App\Workflow\SupportsStrategy: ~

App\MyAreaBricks\Custom\Areabricks\:
resource: '../src/MyAreaBricks/Custom/Areabricks/*'
15 changes: 15 additions & 0 deletions src/MyAreaBricks/Custom/Areabricks/Validity.php
@@ -0,0 +1,15 @@
<?php

namespace App\MyAreaBricks\Custom\Areabricks;

use Pimcore\Extension\Document\Areabrick\Attribute\AsAreabrick;
use Pimcore\Extension\Document\Areabrick\AbstractTemplateAreabrick;

#[AsAreabrick(id: 'validity')]
class Validity extends AbstractTemplateAreabrick
{
public function getName(): string
{
return 'Validity';
}
}
15 changes: 15 additions & 0 deletions 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 %}
<p>
{{ "This is valid for" | trans }}: {{ pimcore_select("validity").getData() | trans }}
</p>
{% endif %}
4 changes: 2 additions & 2 deletions templates/content/default.html.twig
Expand Up @@ -14,7 +14,7 @@
'allowed': ['blockquote', 'embed', 'featurette', 'gallery-carousel', 'gallery-folder',
'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']
'time-slider-featurette', 'validity', 'video', 'wysiwyg', 'wysiwyg-with-images', 'personalized-product-teaser']
}) }}
</div>
{% endblock %}
{% endblock %}
4 changes: 2 additions & 2 deletions templates/default/events.html.twig
Expand Up @@ -14,7 +14,7 @@
'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', 'video', 'wysiwyg', 'wysiwyg-with-images']
'time-slider-featurette', 'validity', 'video', 'wysiwyg', 'wysiwyg-with-images']
}) }}
<div id="vueapp" class="row">
<div class="col-md-12">
Expand Down Expand Up @@ -148,4 +148,4 @@
</section>
</div>
</div>
{% endblock %}
{% endblock %}

0 comments on commit 9acc781

Please sign in to comment.