Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example for Area Brick #552

Merged
merged 10 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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 }}
aryaantony92 marked this conversation as resolved.
Show resolved Hide resolved
</p>
{% endif %}
4 changes: 2 additions & 2 deletions templates/content/default.html.twig
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 %}
Loading