Introduce Hook classes (as per D11.1)

Created on 24 March 2025, 13 days ago

Problem/Motivation

"Drupal 11.1 enables the use of OOP hooks, which are the future of hooks in Drupal. A backwards-compatibility layer is provided for legacy procedural hooks. "
Change-record Support for object oriented hook implementations using autowired services describes how to create a Hook class.

Change-record Improve performance by preventing unnecessary scanning of procedural hooks describes a new parameter: module_name.hooks_converted: true

Change-record Most procedural hook implementations have been converted to a hook class describes the changes in core itself.

Steps to reproduce

Proposed resolution

Introduce hook classes.

Remaining tasks

- convert hook_field
- convert hook_field_views
- convert hook_tokens
- When all is done, introduce parameters: module_name.hooks_converted: true
- consider https://www.drupal.org/node/3490771

User interface changes

API changes

Data model changes

📌 Task
Status

Active

Version

1.0

Component

Code

Created by

🇳🇱Netherlands johnv

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

Comments & Activities

Production build 0.71.5 2024