ogcb_trash_group
Overview
This module was developed as part of the Open Government Community Builder (OGCB) project and is tailored to its needs. It can be used independently but may not cover every use case outside of OGCB.
Integrates the Trash module with the Group module. When an entity, group, or group relationship is trashed or restored, all related items follow automatically.
Scope: This module is built for 1-to-1 group relationships (one entity belongs to exactly one group). While the code iterates over all relationships in case there are multiple, the bidirectional cascade logic is not designed or tested for true 1-to-N scenarios.
Features
- Group cascade: Trashing a group trashes all its relationships and their related entities. Restoring the group restores everything.
- Entity / relationship cascade: Trashing an entity trashes its group relationships and vice versa. Restore works in both directions.
- Delete confirmation form: Replaces the default "This action cannot be undone" text on group relationship delete forms with the same trash-aware description used by the Trash module.
- Loop prevention: A shared re-entrancy guard prevents infinite cascades between entities and relationships.
Requirements
Configuration
For the cascade to work, enable trash for the relevant entity type bundles and their corresponding group relationship bundles at Administration → Configuration → Content → Trash.
No further configuration is needed. The hooks activate automatically once the module is enabled.