Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Varbase FAQs 9.2.1 Minor update available for module varbase_faqs (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

Preprocess

1,322 sites Security covered
View on drupal.org

This module provides a structured way to handle preprocessing in Drupal by introducing a plugin system. It allows you to define preprocessing logic in separate, reusable plugins instead of monolithic theme or module files, leading to cleaner, more object-oriented, and generic code.

This module provides a plugin type for preprocessing. The manager scans for implementations and executes the preprocessors when they meet the given `hook`
criteria. It is designed to make preprocessing more structural and more clearly for themers.

  • Provides a plugin type that you can use in your theme or module
  • Theme plugins are discovered through YML, by creating a MY_THEME.preprocessors.yml you can register them.

With this module you no longer have to write all your preprocessing in your THEME.theme or module file. You gain the possibility to focus preprocessing on specific elements without having to write so many conditional checks for one specific hook implementation to cover all cases.

Yes, this module will help you write more generic, structural and cleaner preprocessing.

Yes, you will gain the possibility to write Object-oriented preprocessing, providing more flexibility and better integration.

No, it does nothing out of the box, you will have to write your own implementations, just as you would with hook_preprocess_HOOK, for any preprocessing you like.

Installation

This module can be installed as any other Drupal module and needs no extra configuration.

Note that if you want to rely on this module in your theme the dependency can't be set explicitly until #474684: Allow themes to declare dependencies on modules is resolved. You will need to make sure the preprocess module is enabled manually.

Activity

Total releases
3
First release
Sep 2025
Latest release
1 week ago
Releases (12 mo)
3 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Release date
2.2.3 Stable Jul 7, 2026
2.2.2 Stable Dec 24, 2025
2.2.1 Stable Sep 11, 2025