Skip to content
Snippets Groups Projects

Issue #3359603: Replace twig_tweak's drupal_image() where possible by drupal_field()

Merged Issue #3359603: Replace twig_tweak's drupal_image() where possible by drupal_field()
All threads resolved!
@@ -13,6 +13,8 @@
#}
{% if image_field.0 %}
{% set image_field_name = image_field['#field_name'] %}
{% set image_field_media_id = image_field['#object'].id() %}
{% set raw_image_width = image_field.0['#item'].getValue().width %}
{% set raw_image_height = image_field.0['#item'].getValue().height %}
{% set raw_image_path = image_field.0['#item'].entity.uri.value %}
@@ -43,9 +45,9 @@
{% set image_rendered %}
{% if raw_image_is_svg %}
{# Print SVG as it is - still buggy with imagecache. #}
{{ drupal_image(raw_image_path, NULL, {alt: raw_image_alt}) }}
{{ drupal_image(raw_image_path, NULL, {alt: raw_image_alt, width: raw_image_width, height: raw_image_height, title: raw_image_title}) }}
{% else %}
{{ drupal_image(raw_image_path, responsive_image_size, {alt: raw_image_alt, loading: 'lazy'}, responsive=true) }}
{{ drupal_field(image_field_name, 'media', image_field_media_id, {type: 'responsive_image', settings: {responsive_image_style: responsive_image_size}})|field_value }}
{% endif %}
{% endset %}
{% endif %}
Loading