responsive-image-formatter.html.twig

Same filename in this branch
  1. 8.9.x core/themes/stable/templates/field/responsive-image-formatter.html.twig
Same filename in other branches
  1. 9 core/themes/stable9/templates/field/responsive-image-formatter.html.twig
  2. 9 core/themes/stable/templates/field/responsive-image-formatter.html.twig
  3. 9 core/modules/responsive_image/templates/responsive-image-formatter.html.twig
  4. 10 core/themes/stable9/templates/field/responsive-image-formatter.html.twig
  5. 10 core/modules/responsive_image/templates/responsive-image-formatter.html.twig
  6. 11.x core/themes/stable9/templates/field/responsive-image-formatter.html.twig
  7. 11.x core/modules/responsive_image/templates/responsive-image-formatter.html.twig

Default theme implementation to display a formatted responsive image field.

Available variables:

  • responsive_image: A collection of responsive image data.
  • url: An optional URL the image can be linked to.

See also

template_preprocess_responsive_image_formatter()

1 theme call to responsive-image-formatter.html.twig
ResponsiveImageFormatter::viewElements in core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php
Builds a renderable array for a field value.

File

core/modules/responsive_image/templates/responsive-image-formatter.html.twig

View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation to display a formatted responsive image field.
  5. *
  6. * Available variables:
  7. * - responsive_image: A collection of responsive image data.
  8. * - url: An optional URL the image can be linked to.
  9. *
  10. * @see template_preprocess_responsive_image_formatter()
  11. *
  12. * @ingroup themeable
  13. */
  14. #}
  15. {% if url %}
  16. <a href="{{ url }}">{{ responsive_image }}</a>
  17. {% else %}
  18. {{ responsive_image }}
  19. {% endif %}

Related topics


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