responsive_image_preprocess_responsive_image() and responsive-image.html.twig never render width and height variables despite claiming otherwise

Created on 6 April 2016, about 8 years ago
Updated 11 January 2024, 5 months ago

Problem/Motivation

From responsive_image_preprocess_responsive_image():

  // Make sure that width and height are proper values
  // If they exists we'll output them
  // @see http://www.w3.org/community/respimg/2012/06/18/florians-compromise/
  if (isset($variables['width']) && empty($variables['width'])) {
    unset($variables['width']);
    unset($variables['height']);
  }
  elseif (isset($variables['height']) && empty($variables['height'])) {
    unset($variables['width']);
    unset($variables['height']);
  }

… but those variables never make it into actual HTML. They are not merged into some general attributes array. Nor are they rendered explicitly in the responsive-image.html.twig template.

Proposed resolution

Either support those variables, or remove them. The current documentation is very vague.

Remaining tasks

TBD

User interface changes

None.

API changes

TBD

Data model changes

TBD

πŸ› Bug report
Status

Closed: outdated

Version

11.0 πŸ”₯

Component
Responsive imageΒ  β†’

Last updated 4 days ago

Created by

πŸ‡§πŸ‡ͺBelgium Wim Leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024