Problem/Motivation
Deleting an entity in the middle/top of the menu tree causes unexpected results for content editors.
Steps to reproduce
- Install Drupal Core
- Create some entities
- Build out a simple main menu tree. For example:
Menu item 1 Menu item 2 |- Menu item 2.a |- Menu item 2.b |- Menu item 2.c
3. Delete the "Menu item 2" node
Woah, all of a sudden the main navigation (site-wide) has three new top-level menu items. This is even more of a surprise if the "Menu item 2" menu item was disabled, or the related entity was unpublished (because you would've forgotten that it has children).
Proposed resolution
Warn before the delete (but we can't do that everywhere), and notify after the delete.
Pre-delete warning
Delete forms currently:
Are you sure you want to delete the content item ?
This action cannot be undone.
Update delete forms with informational text:
This content has 3 menu children. Proceeding will move these one level higher in the menu hierarchy:
* Foo (link to /admin/structure/menu/item/[id]/edit)
* Bar (link to /admin/structure/menu/item/[id]/edit)
* Baz (link to /admin/structure/menu/item/[id]/edit)
Post-delete notification
Show a warning message afterwards (same as above, just changing the verb tense):
Content was deleted that had menu children. These have been moved one level higher in the menu hierarchy:
* Foo (link to /admin/structure/menu/item/[id]/edit)
* Bar (link to /admin/structure/menu/item/[id]/edit)
* Baz (link to /admin/structure/menu/item/[id]/edit)
All entity types
We should should generalize to all entity types. e.g. " was deleted that had menu children..."
Remaining tasks
DiscussionCompleteFinish implementation of pre-delete warningCompleteStart implementation of post-delete notificationComplete
User interface changes
- Messages on delete form.
- Message via messenger after entity is deleted via entity delete form.
API changes
None
Data model changes
None
Release notes snippet
TBD