Skip to main content
Home
Drupal life hacks

Main navigation

  • Drupal
  • React
  • WP
  • Contact
  • About
User account menu
  • Log in

Breadcrumb

  1. Home

Hooks

By admin, 27 October, 2025

🧱 Drupal 11.3: Themes Now Support OOP Hooks

🚀 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.

Tags

  • #Drupal Planet
  • Drupal 11
  • Themes
  • Hooks
  • OOP
  • PHP Attributes
By admin, 28 June, 2025

Drupal 11.2 Hook Migration Guide: Modernize Your Module’s Hooks with Attributes

🔄 Updating hook_help() When Migrating from Drupal 8 to Drupal 11.2

With the release of Drupal 11.2, developers are encouraged to modernize their codebase by replacing legacy hooks with more structured, object-oriented alternatives. One of the most commonly used hooks in legacy modules is hook_help() — the function that adds helpful module documentation to the /admin/help page.

Tags

  • #Drupal Planet
  • Hooks
By admin, 19 May, 2024

Exploring Hooks: Extending Functionality in WordPress and Drupal

Hooks in both WordPress and Drupal 8 are mechanisms for developers to extend and modify the functionality of the core software or themes/modules without modifying the original code directly. However, their implementation differs between the two platforms.

WordPress Hooks:

In WordPress, hooks are actions and filters.

Tags

  • #Drupal Planet
  • WordPress
  • Hooks
By admin, 8 April, 2024

Comparison: Filter Hooks in WordPress vs hook_alter in Drupal

Filter Hooks in WordPress:
- Filter hooks are used to modify data or the result of an operation before it's outputted or used in WordPress.
- They allow for modifying text, metadata, attributes, and other data that WordPress generates or retrieves before it's displayed.
- Example: the_content, the_title, the_excerpt.

Tags

  • #Drupal Planet
  • Hooks
  • WordPress
By admin, 8 April, 2024

A Comparative Analysis of Hooks in WordPress and Drupal: Similarities, Differences, and Use Cases

Hooks in WordPress and Drupal provide similar functionality, allowing developers to interact with the system and modify its behavior without changing the core code.

Here are the main differences between hooks in WordPress and Drupal:

Tags

  • #Drupal Planet
  • Hooks
  • WordPress
Hooks
Powered by Drupal