Picture tag sources appear in inverse order

Created on 1 August 2023, over 1 year ago
Updated 13 September 2024, 4 months ago

Problem/Motivation

Picture tag sources appear in inverse order

Steps to reproduce

Create a responsive image style and set a image field to render with it

Proposed resolution

Change this:

  $breakpoints = array_reverse(\Drupal::service('breakpoint.manager')->getBreakpointsByGroup($responsive_image_style->getBreakpointGroup()));
  foreach ($responsive_image_style->getKeyedImageStyleMappings() as $breakpoint_id => $multipliers) {
    if (isset($breakpoints[$breakpoint_id])) {
      $variables['sources'][] = _responsive_image_build_source_attributes($variables, $breakpoints[$breakpoint_id], $multipliers);
    }
  }

to this:

  $breakpoints = array_reverse(\Drupal::service('breakpoint.manager')->getBreakpointsByGroup($responsive_image_style->getBreakpointGroup()));
  foreach (array_reverse($responsive_image_style->getKeyedImageStyleMappings()) as $breakpoint_id => $multipliers) {
    if (isset($breakpoints[$breakpoint_id])) {
      $variables['sources'][] = _responsive_image_build_source_attributes($variables, $breakpoints[$breakpoint_id], $multipliers);
    }
  }

Remaining tasks

Test it

πŸ› Bug report
Status

Closed: works as designed

Version

11.0 πŸ”₯

Component
Responsive imageΒ  β†’

Last updated 2 days ago

Created by

πŸ‡©πŸ‡ͺGermany Emil Stoianov

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

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.71.5 2024