Replace twig_tweak's drupal_image() where possible by drupal_field()

Created on 11 May 2023, over 1 year ago
Updated 8 August 2023, over 1 year ago

Problem/Motivation

There are several issues with twig_tweak's drupal_image() implementation, which can be seen in 🐛 drupal_image() needs #width / #height values for fully working image cache scale, lazy-loading and img attributes RTBC .
Beside these, using drupal_field() is the better choice as it allows us to still control other field settings in the field display administration and propably better utilizes cache.
Furthermore presumably the handling of the images "alt" property etc. will just work out of the box!

So hopefully drupal_field() will be a bit more stable in general than drupal_image() even if the issue will be fixed one day.

Steps to reproduce

Proposed resolution

See MR. This way we shouldn't run into the issues with drupal_image() anymore.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇩🇪Germany Anybody Porta Westfalica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024