image-formatter.html.twig in Drupal 9
Same filename in this branch
- 9 core/modules/image/templates/image-formatter.html.twig
- 9 core/themes/starterkit_theme/templates/field/image-formatter.html.twig
- 9 core/themes/classy/templates/field/image-formatter.html.twig
- 9 core/themes/stable9/templates/field/image-formatter.html.twig
- 9 core/themes/stable/templates/field/image-formatter.html.twig
Same filename and directory in other branches
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
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.twigView 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 %}