You are here

image-formatter.html.twig in Drupal 10

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.

File

core/themes/starterkit_theme/templates/field/image-formatter.html.twig
View source
  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. {% if url %}
  15. {{ link(image, url) }}
  16. {% else %}
  17. {{ image }}
  18. {% endif %}