image.html.twig

Same filename in this branch
  1. 9 core/themes/stable9/templates/field/image.html.twig
  2. 9 core/themes/seven/templates/classy/field/image.html.twig
  3. 9 core/themes/claro/templates/classy/field/image.html.twig
  4. 9 core/themes/bartik/templates/classy/field/image.html.twig
  5. 9 core/themes/stable/templates/field/image.html.twig
  6. 9 core/themes/starterkit_theme/templates/field/image.html.twig
  7. 9 core/themes/classy/templates/field/image.html.twig
  8. 9 core/modules/system/templates/image.html.twig
Same filename and directory in other branches
  1. 8.9.x core/profiles/demo_umami/themes/umami/templates/classy/field/image.html.twig
  2. 8.9.x core/themes/seven/templates/classy/field/image.html.twig
  3. 8.9.x core/themes/claro/templates/classy/field/image.html.twig
  4. 8.9.x core/themes/bartik/templates/classy/field/image.html.twig
  5. 8.9.x core/themes/stable/templates/field/image.html.twig
  6. 8.9.x core/themes/classy/templates/field/image.html.twig
  7. 8.9.x core/modules/system/templates/image.html.twig
  8. 10 core/profiles/demo_umami/themes/umami/templates/classy/field/image.html.twig
  9. 10 core/themes/stable9/templates/field/image.html.twig
  10. 10 core/themes/claro/templates/classy/field/image.html.twig
  11. 10 core/themes/starterkit_theme/templates/field/image.html.twig
  12. 10 core/modules/system/templates/image.html.twig
  13. 11.x core/profiles/demo_umami/themes/umami/templates/classy/field/image.html.twig
  14. 11.x core/themes/stable9/templates/field/image.html.twig
  15. 11.x core/themes/claro/templates/classy/field/image.html.twig
  16. 11.x core/themes/starterkit_theme/templates/field/image.html.twig
  17. 11.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()

29 theme calls to image.html.twig
contextual_help in core/modules/contextual/contextual.module
Implements hook_help().
FeedViewBuilder::buildComponents in core/modules/aggregator/src/FeedViewBuilder.php
Builds the component fields and properties of a set of entities.
FilemimeFormatter::viewValue in core/modules/file/src/Plugin/Field/FieldFormatter/FilemimeFormatter.php
Generate the output appropriate for one field item.
ImageFieldDisplayTest::testImageFieldDefaultImage in core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php
Tests use of a default image with an image field.
ImageFieldDisplayTest::testImageFieldSettings in core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php
Tests for image field settings.

... 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) }} />

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.