Created
March 24, 2017 16:26
-
-
Save NikLP/3cc1c8f6734c9f9c6cbe18c8f8caf501 to your computer and use it in GitHub Desktop.
Paragraph field extraction
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
// paragraph text field actual text | |
{{ paragraph.field_title.value }} | |
// paragraph link field uri - internal:/ style (useless?) | |
{{ paragraph.field_link.0.uri }} | |
// content has this value - is processed, not validated (good in some cases) | |
{{ content.field_link[0]['#url'] }} | |
// paragraph image field uri | |
{{ paragraph.field_image.entity.fileuri }} | |
// actualised link for image field uri | |
{{ file_url(paragraph.field_image.entity.fileuri) }} | |
// nominal output for theming an image link with the above | |
{% if paragraph.field_link.0.uri %} | |
<a href="{{ content.field_link[0]['#url'] }}"> | |
{% endif %} | |
<img src="{{ file_url(paragraph.field_image.entity.fileuri) }}" | |
alt="{{ paragraph.field_title.value }}" class="img-responsive" /> | |
{% if paragraph.field_link.0.uri %} | |
</a> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment