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_uiis enabled, that all the formatters having this image style as dependency were disabled. - If module
dblogis 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.
Comments
Comment #2
claudiu.cristeaPostponing on #2562107: EntityDisplayBase should react on removal of its components dependencies.
Comment #3
claudiu.cristeaComment #4
claudiu.cristeaThis is now a duplicate of #2479487: ImageStyles can be deleted while having dependent configuration..