After deleting image style, that is in active use by consumer I get:

The website encountered an unexpected error. Please try again later.
Error: Call to a member function label() on null in consumer_image_styles_consumers_list_alter() (line 53 of modules/contrib/consumer_image_styles/consumer_image_styles.module)

when accessing /admin/config/services/consumer.

The deleted image style is still visible on consumer config page.

Temporary solution: comment line 53 of modules/contrib/consumer_image_styles/consumer_image_styles.module and deactivate the image style on consumer admin page.

Comments

liborvanek created an issue. See original summary.

e0ipso’s picture

Thanks for the report! This is definitely an oversight.

I see two different solutions:

  1. React on the image style upon validation and re-save all the consumer entities.
  2. Validate that the configured image styles exist before using them.
ndobromirov’s picture

Status: Active » Needs review
StatusFileSize
new7.85 KB

Here is a patch that aims at resolving the issue.
There is a new utility service in the class that handles loading of image styles for the consumer.
Loading happens in bulk (loadMultiple).

The new service is injected in the ImageEntityNormalizer and used in the summary lists generation.
Small refactorings here and there.

e0ipso’s picture

Status: Needs review » Fixed

Thanks for the fix @ndobromirov. You are all over the place! Kudos on the fantastic work, and thanks for the help.

  • e0ipso committed 5e4d847 on 8.x-2.x authored by ndobromirov
    Issue #2956739 by ndobromirov, liborvanek, e0ipso: Consumer image style...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.