image-formatter.html.twig in Drupal 10
Same filename in this branch
- 10 core/modules/image/templates/image-formatter.html.twig
- 10 core/themes/starterkit_theme/templates/field/image-formatter.html.twig
- 10 core/themes/classy/templates/field/image-formatter.html.twig
- 10 core/themes/stable9/templates/field/image-formatter.html.twig
- 10 core/themes/stable/templates/field/image-formatter.html.twig
Same filename and directory in other branches
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
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/modules/image/templates/image-formatter.html.twigView source
- {#
- /**
- * @file
- * 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 template_preprocess_image_formatter()
- *
- * @ingroup themeable
- */
- #}
- {% if url %}
- {{ link(image, url) }}
- {% else %}
- {{ image }}
- {% endif %}