Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {#
- /**
- * @file
- * Theme override to display a formatted image field.
- *
- * Available variables:
- * - image: A collection of image data.
- * - image_style: An optional image style.
- * - url: An optional URL the image can be linked to.
- *
- * @see template_preprocess_image_formatter()
- */
- #}
- {% set titles = image['#title']|split('||', 2) %}
- {% set caption = titles['0'] %}
- {% set image = image|merge({'#title': titles['1'] }) %}
- {% if caption %}
- <figure role="group">
- {% endif %}
- {% if url %}
- <a href="{{ url }}">{{ image }}</a>
- {% else %}
- {{ image }}
- {% endif %}
- {% if caption %}
- <figcaption>{{ caption }}</figcaption>
- </figure>
- {% endif %}
Add Comment
Please, Sign In to add comment