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

CommentFileSizeAuthor
#3 3378419-picture-tag-sources.patch1.36 KBemil stoianov

Issue fork drupal-3378419

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Emil Stoianov created an issue. See original summary.

emil stoianov’s picture

StatusFileSize
new1.36 KB

For those who need the patch now

cilefen’s picture

The tag sources appear in inverse order as compared to what?

longwave’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: -responsive images +Needs issue summary update

Please explain - maybe with an example - of the current output, what you think the output should be, and why.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

pameeela’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)
Issue tags: +Bug Smash Initiative

No additional info provided so I'm closing this, if anyone is able to reproduce it please update the issue summary with steps.