Plugin Properties
Plugins can be customized with various properties.
Properties Overview
hooks
Specifies the hooks this plugin should act upon. Plugins can act on multiple hooks if desired, hence this value being an array. The values here are the same you would replace HOOK with in a hook_preprocess_HOOK function.
Example Values
nodenode__basic_pagefieldpage_titleregion
themes (Module Plugins Only)
Designate which themes this plugin should act on. This is only useful in modules when you want to limit which themes your module plugins affect. Plugins defined in themes only act upon the themes they are defined in.
Values should be the machine names of your themes.
weight
Determines the weight of the plugin, affecting execution order relative to other plugins affecting the same hook.
Works just like weight in other parts of Drupal. The heavier the weight, the later the plugin will run.
Modifying Properties
When configuring your plugin with YAML Discovery, the properties are set within the .preprocessors.yml file.
MY_THEME.preprocessor.node:
class: '\Drupal\MY_THEME\Plugin\preprocessors\NodePreprocessor'
hooks:
- node
weight: 0On the other hand, when using Attribute/Annotation-based Plugins, the properties are set within the attribute/annotation.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion
Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.