Commit 6932e25e authored by Jess's avatar Jess
Browse files

Revert "Issue #3267870 by heddn, Fabianx: Order image mappings by breakpoint...

Revert "Issue #3267870 by heddn, Fabianx: Order image mappings by breakpoint ID and numeric multiplier"

This reverts commit 7cbd470e.
parent ad005a74
Loading
Loading
Loading
Loading
+2 −3
Changes for core/modules/breakpoint/src/BreakpointManager.php: 2 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -133,9 +133,8 @@ public function processDefinition(&$definition, $plugin_id) {
    if (!in_array('1x', $definition['multipliers'])) {
      $definition['multipliers'][] = '1x';
    }
    // Ensure that multipliers are sorted numerically so 1x, 1.5x and 2x
    // come out in that order instead of 1.5x, 1x, 2x.
    sort($definition['multipliers'], SORT_NUMERIC);
    // Ensure that multipliers are sorted correctly.
    sort($definition['multipliers']);
  }

  /**
−14
Changes for core/modules/responsive_image/responsive_image.post_update.php: 0 added lines, 14 removed lines.
Original line number Diff line number Diff line
@@ -5,10 +5,6 @@
 * Post update functions for Responsive Image.
 */

use Drupal\Core\Config\Entity\ConfigEntityUpdater;
use Drupal\responsive_image\ResponsiveImageConfigUpdater;
use Drupal\responsive_image\ResponsiveImageStyleInterface;

/**
 * Implements hook_removed_post_updates().
 */
@@ -17,13 +13,3 @@ function responsive_image_removed_post_updates() {
    'responsive_image_post_update_recreate_dependencies' => '9.0.0',
  ];
}

/**
 * Re-order mappings by breakpoint ID and descending numeric multiplier order.
 */
function responsive_image_post_update_order_multiplier_numerically(array &$sandbox = NULL): void {
  $responsive_image_config_updater = \Drupal::classResolver(ResponsiveImageConfigUpdater::class);
  \Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'responsive_image_style', function (ResponsiveImageStyleInterface $responsive_image_style) use ($responsive_image_config_updater): bool {
    return $responsive_image_config_updater->orderMultipliersNumerically($responsive_image_style);
  });
}
−12
Changes for core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php: 0 added lines, 12 removed lines.
Original line number Diff line number Diff line
@@ -3,9 +3,7 @@
namespace Drupal\responsive_image\Entity;

use Drupal\Core\Config\Entity\ConfigEntityBase;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\image\Entity\ImageStyle;
use Drupal\responsive_image\ResponsiveImageConfigUpdater;
use Drupal\responsive_image\ResponsiveImageStyleInterface;

/**
@@ -112,16 +110,6 @@ public function __construct(array $values, $entity_type_id = 'responsive_image_s
    parent::__construct($values, $entity_type_id);
  }

  /**
   * {@inheritdoc}
   */
  public function preSave(EntityStorageInterface $storage) {
    parent::preSave($storage);
    $config_updater = \Drupal::classResolver(ResponsiveImageConfigUpdater::class);
    assert($config_updater instanceof ResponsiveImageConfigUpdater);
    $config_updater->orderMultipliersNumerically($this);
  }

  /**
   * {@inheritdoc}
   */
−47

File deleted.

Loading