Problem/Motivation

This is a followup and an effect of #2562107: EntityDisplayBase should react on removal of its components dependencies.

When ImageStyle has been designed, there was no mechanism implemented in EntityDisplayBase to resolve the cases when a component loses its dependencies. As a consequence, if an image style would have been removed, the dependency manager would remove the entire entity view displays where this image style was set as a component (formatter) settings. To work-around this issue, ImageStyle class introduced the concept on a replacement image style. When a image style involved in field formatters would have been deleted, ImageStyle would replace that style with the replacement style in all entity view displays.

The problem is that this is not the expected behavior. Also architectural speaking this is more like a hack, while developers need to se a replacement image style and, right now, this is never done. The normal behavior for such cases is the native behavior introduced in #2562107: EntityDisplayBase should react on removal of its components dependencies:

  • All components (formatters) where this image style is involved should be disabled.
  • The site admin should be warned by registering a log entry.

Proposed resolution

Remove the replacement image style logic. Rely on the native behavior introduced in #2562107: EntityDisplayBase should react on removal of its components dependencies.

Remaining tasks

None.

User interface changes

When deleting an image style that was configured as formatter for image fields, admins will notice:

  • If module field_ui is enabled, that all the formatters having this image style as dependency were disabled.
  • If module dblog is enabled, a 'warning' message in the log.

API changes

Removal of method \Drupal\image\ImageStyleInterface::getReplacementID(). This method was never used because the containing protected values is never set, at least in core.

Data model changes

Comments

claudiu.cristea created an issue. See original summary.

claudiu.cristea’s picture

claudiu.cristea’s picture

Issue summary: View changes
claudiu.cristea’s picture

Status: Postponed » Closed (duplicate)