diff --git a/core/modules/image/lib/Drupal/image/Form/ImageStyleEditForm.php b/core/modules/image/lib/Drupal/image/Form/ImageStyleEditForm.php index 40f1d1a..a2468f2 100644 --- a/core/modules/image/lib/Drupal/image/Form/ImageStyleEditForm.php +++ b/core/modules/image/lib/Drupal/image/Form/ImageStyleEditForm.php @@ -76,7 +76,7 @@ public function form(array $form, array &$form_state) { // Render effects below parent elements. '#weight' => 5, ); - foreach ($this->entity->getEffects()->sort() as $effect) { + foreach ($this->entity->getEffects() as $effect) { $key = $effect->getUuid(); $form['effects'][$key]['#weight'] = isset($form_state['input']['effects']) ? $form_state['input']['effects'][$key]['weight'] : NULL; $form['effects'][$key]['label'] = array( diff --git a/core/modules/image/lib/Drupal/image/ImageEffectBag.php b/core/modules/image/lib/Drupal/image/ImageEffectBag.php index 0624183..24641bc 100644 --- a/core/modules/image/lib/Drupal/image/ImageEffectBag.php +++ b/core/modules/image/lib/Drupal/image/ImageEffectBag.php @@ -7,7 +7,6 @@ namespace Drupal\image; -use Drupal\Component\Utility\MapArray; use Drupal\Component\Uuid\Uuid; use Drupal\Component\Plugin\DefaultPluginBag; @@ -52,10 +51,14 @@ public function updateConfiguration(array $configuration) { /** * {@inheritdoc} */ - public function sort() { - uasort($this->configurations, 'drupal_sort_weight'); - $this->instanceIDs = MapArray::copyValuesToKeys(array_keys($this->configurations)); - return $this; + public function sortHelper($aID, $bID) { + $a_weight = $this->get($aID)->getWeight(); + $b_weight = $this->get($bID)->getWeight(); + if ($a_weight == $b_weight) { + return 0; + } + + return ($a_weight < $b_weight) ? -1 : 1; } } diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php index 6bcf733..90b1533 100644 --- a/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php +++ b/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php @@ -156,7 +156,7 @@ function testStyle() { $effect_edits_order = array_keys($effect_edits); $order_correct = TRUE; $index = 0; - foreach ($style->getEffects()->sort() as $effect) { + foreach ($style->getEffects() as $effect) { if ($effect_edits_order[$index] != $effect->getPluginId()) { $order_correct = FALSE; } @@ -203,7 +203,7 @@ function testStyle() { $effect_edits_order = array_reverse($effect_edits_order); $order_correct = TRUE; $index = 0; - foreach ($style->getEffects()->sort() as $effect) { + foreach ($style->getEffects() as $effect) { if ($effect_edits_order[$index] != $effect->getPluginId()) { $order_correct = FALSE; }