🚀 Introduction
Drupal 11.3.0 brings a powerful update for themers and front-end developers:
themes can now implement hooks using Object-Oriented Programming (OOP) with the #[Hook()] attribute — just like modules have been able to do since Drupal 11.
This means no more long procedural functions in template.php.
Instead, you can organize your logic cleanly in classes inside the theme’s src/Hook directory.