Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Paragraph field extraction
// 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
You can’t perform that action at this time.