Add the concept of trash handlers

Created on 12 February 2025, 27 days ago

Problem/Motivation

Trash support requires various entity type-specific customizations, for example:
- altering search_node_search queries for nodes
- handling the deletion of menu link definitions for custom menu links
- handling the deletion of descendants for taxonomy terms
- etc.

Proposed resolution

Add the concept of per-entity type trash handlers.

A few options were considered for this implementation:

Entity handlers:
- these were the obvious fit at first sight, but had a deal breaker: we need trash handlers to implement non-entity-specific hooks (hook_query_alter() for example), and entity handlers can't do that

Plugins:
- same problem as entity handlers, plus the overhead of a plugin manager and the fact that they won't be exposed anywhere in the UI

Tagged services:
- they can implement hooks if placed in a specific location (at least until Support hooks (Hook attribute) in components Active )
- minimal overhead

Remaining tasks

- add two new methods on TrashHandlerInterface and a default implementation for the messaging displayed on entity delete and restore forms.

User interface changes

Nope.

API changes

New API for trash handlers based on tagged services.

Data model changes

Nope.

📌 Task
Status

Active

Version

3.0

Component

Code

Created by

🇷🇴Romania amateescu

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024