1. 8.5.x core/themes/stable/templates/field/image-formatter.html.twig
  2. 8.5.x core/modules/image/templates/image-formatter.html.twig
  3. 8.5.x core/themes/classy/templates/field/image-formatter.html.twig
  4. 8.0.x core/modules/image/templates/image-formatter.html.twig
  5. 8.0.x core/themes/stable/templates/field/image-formatter.html.twig
  6. 8.0.x core/themes/classy/templates/field/image-formatter.html.twig
  7. 8.1.x core/themes/classy/templates/field/image-formatter.html.twig
  8. 8.1.x core/modules/image/templates/image-formatter.html.twig
  9. 8.1.x core/themes/stable/templates/field/image-formatter.html.twig
  10. 8.2.x core/themes/classy/templates/field/image-formatter.html.twig
  11. 8.2.x core/modules/image/templates/image-formatter.html.twig
  12. 8.2.x core/themes/stable/templates/field/image-formatter.html.twig
  13. 8.3.x core/themes/classy/templates/field/image-formatter.html.twig
  14. 8.3.x core/modules/image/templates/image-formatter.html.twig
  15. 8.3.x core/themes/stable/templates/field/image-formatter.html.twig
  16. 8.4.x core/modules/image/templates/image-formatter.html.twig
  17. 8.4.x core/themes/stable/templates/field/image-formatter.html.twig
  18. 8.4.x core/themes/classy/templates/field/image-formatter.html.twig
  19. 8.6.x core/themes/stable/templates/field/image-formatter.html.twig
  20. 8.6.x core/modules/image/templates/image-formatter.html.twig
  21. 8.6.x core/themes/classy/templates/field/image-formatter.html.twig

Default theme implementation 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 also

template_preprocess_image_formatter()

3 theme calls to image-formatter.html.twig
ImageFormatter::viewElements in core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php
Builds a renderable array for a field value.
ImageThemeFunctionTest::testImageFormatterTheme in core/modules/image/src/Tests/ImageThemeFunctionTest.php
Tests usage of the image field formatters.
MediaThumbnailFormatter::viewElements in core/modules/media/src/Plugin/Field/FieldFormatter/MediaThumbnailFormatter.php
Builds a renderable array for a field value.

File

core/modules/image/templates/image-formatter.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation 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. * @ingroup themeable
  14. */
  15. #}
  16. {% if url %}
  17. <a href="{{ url }}">{{ image }}</a>
  18. {% else %}
  19. {{ image }}
  20. {% endif %}

Related topics