Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

image.html.twig

Same filename in this branch
  1. 11.1.x core/themes/stable9/templates/field/image.html.twig
  2. 11.1.x core/themes/starterkit_theme/templates/field/image.html.twig
  3. 11.1.x core/themes/claro/templates/classy/field/image.html.twig
  4. 11.1.x core/modules/system/templates/image.html.twig

Theme override of an image.

Available variables:

  • attributes: HTML attributes for the img tag.
  • style_name: (optional) The name of the image style applied.

See also

template_preprocess_image()

12 theme calls to image.html.twig
ContextualHooks::help in core/modules/contextual/src/Hook/ContextualHooks.php
Implements hook_help().
FilemimeFormatter::viewValue in core/modules/file/src/Plugin/Field/FieldFormatter/FilemimeFormatter.php
Generate the output appropriate for one field item.
LayoutDefinition::getIcon in core/lib/Drupal/Core/Layout/LayoutDefinition.php
Builds a render array for an icon representing the layout.
OEmbedFormatter::viewElements in core/modules/media/src/Plugin/Field/FieldFormatter/OEmbedFormatter.php
Builds a renderable array for a field value.
SystemBrandingBlock::build in core/modules/system/src/Plugin/Block/SystemBrandingBlock.php
Builds and returns the renderable array for this block plugin.

... See full list

File

core/profiles/demo_umami/themes/umami/templates/classy/field/image.html.twig

View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override of an image.
  5. *
  6. * Available variables:
  7. * - attributes: HTML attributes for the img tag.
  8. * - style_name: (optional) The name of the image style applied.
  9. *
  10. * @see template_preprocess_image()
  11. */
  12. #}
  13. {%
  14. set classes = [
  15. style_name ? 'image-style-' ~ style_name|clean_class,
  16. ]
  17. %}
  18. <img{{ attributes.addClass(classes) }} />
RSS feed
Powered by Drupal