class Preprocess

Attribute for defining a class method as a preprocess function.

Pass no arguments for hook_preprocess `#[Preprocess]`. For `hook_preprocess_HOOK` pass the `HOOK` without the `hook_preprocess` portion `#[Preprocess('HOOK')]`.

See \Drupal\Core\Hook\Attribute\Hook for additional information.

Hierarchy

Expanded class hierarchy of Preprocess

7 files declare their use of Preprocess
CommentEmptyTitleTestThemeHooks.php in core/modules/comment/tests/modules/comment_empty_title_test/src/Hook/CommentEmptyTitleTestThemeHooks.php
CommentThemeHooks.php in core/modules/comment/src/Hook/CommentThemeHooks.php
ContextualThemeHooks.php in core/modules/contextual/src/Hook/ContextualThemeHooks.php
LocaleThemeHooks.php in core/modules/locale/src/Hook/LocaleThemeHooks.php
ModuleTestOopPreprocessThemeHooks.php in core/modules/system/tests/modules/module_test_oop_preprocess/src/Hook/ModuleTestOopPreprocessThemeHooks.php

... See full list

4 string references to 'Preprocess'
ModuleHandlerTest::testOopPreprocess in core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php
Tests Oop preprocess functions.
ModuleHandlerTest::testProceduralPreprocess in core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php
Tests procedural preprocess functions.
Registry::build in core/lib/Drupal/Core/Theme/Registry.php
Builds the theme registry cache.
ThemeTestHooks::themeRegistryAlter in core/modules/system/tests/modules/theme_test/src/Hook/ThemeTestHooks.php
Implements hook_theme_registry_alter().

File

core/lib/Drupal/Core/Hook/Attribute/Preprocess.php, line 16

Namespace

Drupal\Core\Hook\Attribute
View source
class Preprocess extends Hook {
    
    /**
     * {@inheritdoc}
     */
    public const PREFIX = 'preprocess';

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
Hook::SUFFIX public constant The hook suffix such as `alter`.
Hook::__construct public function Constructs a Hook attribute object.
Preprocess::PREFIX public constant The hook prefix such as `form`. Overrides Hook::PREFIX

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.