Skip to main content
Home
Drupal life hacks

Main navigation

  • Drupal
  • React
  • WP
  • Contact
  • About
User account menu
  • Log in
By admin, 17 October, 2025

Drupal 11.3 Deprecates template_preprocess_HOOK and file/includes in hook_theme(). What Developers Need to Change

Drupal 11.3 introduces an important shift for theme and module developers:
the long-standing automatic discovery of template_preprocess_HOOK() functions is now deprecated, along with the file and includes keys in hook_theme().

These patterns have been around since Drupal 7 and worked well in the procedural era. But with modern autoloading and class-based preprocessors, they’re no longer necessary — and now officially discouraged.

In this article, we’ll cover:

Tags

  • #Drupal Planet
  • Drupal preprocess callbacks
By admin, 16 October, 2025

How to Change the Browser URL Without Reloading the Page in Drupal 11 Using SetBrowserUrl

Drupal 11.3.0 introduced a long-awaited feature that brings AJAX behavior to a new level — the Views module can now update the browser URL without reloading the page. This is made possible thanks to the new AJAX command SetBrowserUrl.


Why This Matters

Previously, AJAX-powered Views had one major UX issue: after filtering, sorting, or pagination, the page URL remained unchanged. This led to several problems:

Tags

  • #Drupal Planet
  • SetBrowserUrl
By admin, 15 October, 2025

Drupal 11.3: Simplifying Plugin Development with Autowired create() in PluginBase

Drupal has always been flexible when it comes to plugins, but dependency injection in plugins has historically required boilerplate code. In Drupal 11.3, the PluginBase class introduces a game-changing feature: a generic create() factory method with autowired parameters. This update simplifies plugin development and reduces repetitive code.

Tags

  • #Drupal Planet
  • Plugin Development
  • PluginBase
By admin, 14 October, 2025

How Drupal 11.3 Makes Working with HTMX Easier: A Deep Dive into HtmxRequestInfoTrait

Drupal 11.3 introduced a small but powerful enhancement for developers working with HTMX — a new trait called HtmxRequestInfoTrait. This addition dramatically simplifies how we detect and process HTMX requests inside controllers, forms, and services.

In this article, we’ll cover:

Tags

  • #Drupal Planet
  • HTMX
By admin, 9 October, 2025

Drupal 11.3: Views Plugins Now Require Explicit Initial Preprocess Callbacks

Published in Drupal 11.3.x

Drupal 11.3 introduces a significant change in how preprocess functions for Views plugins are handled.
Previously, Drupal would implicitly discover functions like template_preprocess_HOOK() and apply them automatically to corresponding templates. This implicit behavior is now deprecated.

Tags

  • #Drupal Planet
By admin, 7 October, 2025

Deprecation Alert: theme_file in Views Plugins Is Going Away in Drupal 12

Introduced in Drupal 11.3.0

Drupal core continues its modernization journey, and one of the latest updates affects how Views plugins define their template preprocess functions.
If your Views plugin currently uses the theme_file key in its plugin definition — it’s time to update your code.


🔍 What Has Changed

In previous Drupal versions, Views plugins could include a key like this in their plugin annotation:

Tags

  • #Drupal Planet
By admin, 6 October, 2025

Understanding Render Arrays and Theme Hooks in Drupal

Drupal is a powerful content management system that separates data from presentation. Two key concepts that make this possible are render arrays and theme hooks. Understanding these is essential for writing clean, maintainable Drupal code.


1. What is a Render Array?

A render array is a structured PHP array that tells Drupal how to render a piece of content. It is processed recursively by the Renderer service (RendererInterface).

Tags

  • #Drupal Planet
  • Render Array
  • Theme hook
By admin, 4 October, 2025
This kind of visual immediately shows readers the architectural difference and why Drupal is more robust for complex projects.

5 Reasons Why WordPress Doesn’t Separate Business Logic and Presentation (With Examples)

Modern web applications are built on the principle of separating business logic (data processing, site rules) from presentation logic (how content is displayed to the user). Drupal strictly follows this principle, while WordPress often mixes these layers. Here are five reasons with concrete examples.


1. Functionality Tied to the Theme

WordPress:

Tags

  • #Drupal Planet
  • WordPress
By admin, 3 October, 2025

Creating a Custom Token Decorator in Drupal: Extend and Control Token Replacement

🔹 How to Create a Custom Decorator for Token in Drupal

In Drupal, tokens allow dynamic values to be substituted into text, email templates, fields, and more. There are two main Token classes:

Tags

  • #Drupal Planet
  • Token
By admin, 3 October, 2025

Theme Hook Definitions for Views Plugins in Drupal 11: Moving Preprocess Logic to ThemeHooks Classes

In Drupal 11.3.0, a change landed that modernizes how Views plugins handle their preprocess callbacks. If you are maintaining custom Views plugins or themes, this is important to know.


Background: How It Worked Before

Traditionally, Drupal discovered preprocess functions implicitly.
For example, if you had a Views display plugin with a theme hook called views_display_example, Drupal would look for this function automatically:

Tags

  • #Drupal Planet
  • ThemeHooks classes

Pagination

  • First page
  • Previous page
  • Page 1
  • Page 2
  • Page 3
  • Page 4
  • Page 5
  • Page 6
  • Page 7
  • Page 8
  • Page 9
  • …
  • Next page
  • Last page
Powered by Drupal