Last active
August 25, 2024 07:36
-
-
Save pixelstorm/b6134581d45b466e176d4182cfbe533d to your computer and use it in GitHub Desktop.
starting point for drupal paragraph block, just the html stuff and a twig variable for block_name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set block_name = "example_class" %} | |
{% set classes = [ | |
'paragraph', | |
'paragraph--type--' ~ paragraph.bundle|clean_class, | |
view_mode ? 'paragraph--view-mode--' ~ view_mode|clean_class, | |
not paragraph.isPublished() ? 'paragraph--unpublished', | |
block_name | |
] %} | |
{% block paragraph %} | |
{% block content %} | |
<section class="{{ attributes.addClass(classes) }}"> | |
<div class="container"> | |
{{ content }} | |
{{ dump(content) }} | |
</div> | |
</section> | |
{% endblock %} | |
{% endblock paragraph %} |
if your block does use microcontent.. then reference you microcontent field from {{ content.your_micro_content }}
If you have a blank page.. and your creating blocks. this is a good starting point.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this approach will work with paragraph fields add directly on the page. Not when referencing microcontent or content reference entity.