Problem/Motivation

Currently ImageStyle::replaceImageStyle() uses field_read_instances() to find image field instances that examined for used image style. This operation is expensive.
Also fields was converted to CMI and this function deprecated.

Proposed resolution

Use new entity_load_multiple_by_properties() function to load only image fields.

CommentFileSizeAuthor
#1 2030207-image-style-1.patch4.43 KBandypost

Comments

andypost’s picture

Status: Active » Needs review
StatusFileSize
new4.43 KB

Just a stub

amateescu’s picture

+++ b/core/modules/image/lib/Drupal/image/Plugin/Core/Entity/ImageStyle.php
@@ -117,33 +117,46 @@ public static function postDelete(EntityStorageControllerInterface $storage_cont
+        // @todo check displays other then default and form_modes because
+        //   other widgets could have settings for deleted style.

I guess the best way is to loop over all form_display config files:

config_get_storage_names_with_prefix('entity.form_display.)

andypost’s picture

Issue tags: +Needs tests

@amateescu thanx a lot for idea!

Also needs to extent tests to cover form displays as well

Status: Needs review » Needs work

The last submitted patch, 1: 2030207-image-style-1.patch, failed testing.

swentel’s picture

Issue summary: View changes
Status: Needs work » Closed (fixed)

This was fixed in a different issue.