Guest User

Untitled

a guest
Feb 21st, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. {#
  2. /**
  3. * @file
  4. * Theme override to display a formatted image field.
  5. *
  6. * Available variables:
  7. * - image: A collection of image data.
  8. * - image_style: An optional image style.
  9. * - url: An optional URL the image can be linked to.
  10. *
  11. * @see template_preprocess_image_formatter()
  12. */
  13. #}
  14.  
  15. {% set titles = image['#title']|split('||', 2) %}
  16. {% set caption = titles['0'] %}
  17. {% set image = image|merge({'#title': titles['1'] }) %}
  18.  
  19. {% if caption %}
  20. <figure role="group">
  21. {% endif %}
  22. {% if url %}
  23. <a href="{{ url }}">{{ image }}</a>
  24. {% else %}
  25. {{ image }}
  26. {% endif %}
  27. {% if caption %}
  28. <figcaption>{{ caption }}</figcaption>
  29. </figure>
  30. {% endif %}
Add Comment
Please, Sign In to add comment