image-formatter.html.twig
Same filename in this branch
Same filename in other branches
- 8.9.x core/themes/stable/templates/field/image-formatter.html.twig
- 8.9.x core/themes/classy/templates/field/image-formatter.html.twig
- 8.9.x core/modules/image/templates/image-formatter.html.twig
- 10 core/themes/stable9/templates/field/image-formatter.html.twig
- 10 core/themes/starterkit_theme/templates/field/image-formatter.html.twig
- 10 core/modules/image/templates/image-formatter.html.twig
- 11.x core/themes/stable9/templates/field/image-formatter.html.twig
- 11.x core/themes/starterkit_theme/templates/field/image-formatter.html.twig
- 11.x core/modules/image/templates/image-formatter.html.twig
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 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/ tests/ src/ Kernel/ 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/
themes/ stable/ templates/ field/ image-formatter.html.twig
View source
- {#
- /**
- * @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()
- */
- #}
- {% if url %}
- {{ link(image, url) }}
- {% else %}
- {{ image }}
- {% endif %}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.