You are here

image-caption-formatter.html.twig in Image Field Caption 8

Default theme implementation to display a formatted image field with a caption.

Available variables:

  • image: A collection of image data.
  • image_style: An optional image style.
  • url: An optional URL the image can be linked to.
  • caption : An optional image caption.

File

templates/image-caption-formatter.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation to display a formatted image field with a caption.
  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. * - caption : An optional image caption.
  11. *
  12. * @see template_preprocess_image_caption_formatter()
  13. *
  14. * @ingroup themeable
  15. */
  16. #}
  17. {% if url %}
  18. <a href="{{ url }}">{{ image }}</a>
  19. {% else %}
  20. {{ image }}
  21. {% endif %}
  22. {% if caption %}
  23. <blockquote class="image-field-caption">{{ caption|raw }}</blockquote>
  24. {% endif %}