Created
November 21, 2017 14:35
-
-
Save krisrobinson/b10b525ad8de755fa225fcf2807fe16d to your computer and use it in GitHub Desktop.
Drupal 8 node.html.twig snippets
This file contains 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
{# Kint | |
{{ kint(content.field_sections['#items'].getValue()) }} | |
#} | |
{# if field is defined | |
{% if node.field_sections[key].entity.field_section_image.entity.fileuri is defined %} | |
<img src="{{ node.field_sections[key].entity.field_section_image.entity.fileuri | image_style('large') }}"> | |
{% endif %} | |
#} | |
{# Print out an image with twig_tweak module's image_style() | |
{% for key,value in node.field_sections.value %} | |
<img src="{{ node.field_sections[key].entity.field_section_image.entity.fileuri | image_style('large') }}"> | |
{% endfor %} | |
#} | |
{# Print out a particular paragraph with key and field value | |
{{ node.field_sections[1].entity.field_section_text.value | raw }} | |
#} | |
{# Loop through field_sections | |
<div> | |
{% for key,value in node.field_sections.value %} | |
{{ content.field_sections[key] }} | |
{% endfor %} | |
</div> | |
#} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment