Problem/Motivation
When the Trash module is enabled, group content menus are not cleaned up when a group is deleted through trash.
The existing cleanup logic in group_content_menu_group_delete relies on loading group relationships. However, when the Trash module purges a group, the group relationships have already been removed from the database by the time hook_group_delete fires. So the menus are never deleted — they remain as orphans in the group_content_menu_field_data table.
Steps to reproduce
- Enable the Trash module
- Create a group
- Create a menu
- Delete the group (this soft-deletes/trashes it)
- Delete the group from trash (hard delete)
- Check the
group_content_menu_field_datadatabase table — the group menu is still present
Proposed resolution
React to group relationships being deleted, and delete the menu if it doesn't have other relationships pointing to it.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork group_content_menu-3578503
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
alecsmrekar commentedComment #4
gabesulliceWorks exactly as promised :)
Comment #5
heddnPosted some feedback on the MR.