diff --git a/core/modules/image/config/schema/image.schema.yml b/core/modules/image/config/schema/image.schema.yml index 0006ad7..a43aae2 100644 --- a/core/modules/image/config/schema/image.schema.yml +++ b/core/modules/image/config/schema/image.schema.yml @@ -11,6 +11,7 @@ image.style.*: label: 'Label' effects: type: sequence + orderby: key sequence: type: mapping mapping: diff --git a/core/modules/image/image.post_update.php b/core/modules/image/image.post_update.php index 04d8c4b..0f91dd8 100644 --- a/core/modules/image/image.post_update.php +++ b/core/modules/image/image.post_update.php @@ -7,6 +7,7 @@ use Drupal\Core\Entity\Entity\EntityViewDisplay; use Drupal\Core\Entity\Entity\EntityFormDisplay; +use Drupal\image\Entity\ImageStyle; /** * Saves the image style dependencies into form and view display entities. @@ -20,3 +21,17 @@ function image_post_update_image_style_dependencies() { $display->save(); } } + +/** + * Saves the image styles to ensure a consistent effect order. + */ +function image_post_update_image_style_effect_order() { + $styles = ImageStyle::loadMultiple(); + /** @var \Drupal\image\ImageStyleInterface[] $styles */ + foreach ($styles as $style) { + if ($style->getEffects()->count() > 1) { + // Re-save each config entity to sort effects. + $style->save(); + } + } +}