function hook_preprocess_HOOK in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Render/theme.api.php \hook_preprocess_HOOK()
- 7 modules/system/theme.api.php \hook_preprocess_HOOK()
- 9 core/lib/Drupal/Core/Render/theme.api.php \hook_preprocess_HOOK()
Preprocess theme variables for a specific theme hook.
This hook allows modules to preprocess theme variables for a specific theme hook. It should only be used if a module needs to override or add to the theme preprocessing for a theme hook it didn't define.
For more detailed information, see the Theme system overview topic.
Parameters
$variables: The variables array (modify in place).
Related topics
309 functions implement hook_preprocess_HOOK()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- bartik_preprocess_block in core/
themes/ bartik/ bartik.theme - Implements hook_preprocess_HOOK() for block.html.twig.
- bartik_preprocess_html in core/
themes/ bartik/ bartik.theme - Implements hook_preprocess_HOOK() for HTML document templates.
- bartik_preprocess_image_widget in core/
themes/ bartik/ bartik.theme - Implements hook_preprocess_image_widget().
- bartik_preprocess_links in core/
themes/ bartik/ bartik.theme - Implements template_preprocess_links().
- bartik_preprocess_links__media_library_menu in core/
themes/ bartik/ bartik.theme - Implements hook_preprocess_links__media_library_menu().
File
- core/
lib/ Drupal/ Core/ Render/ theme.api.php, line 587 - Hooks and documentation related to the theme and render system.
Code
function hook_preprocess_HOOK(&$variables) {
// This example is from rdf_preprocess_image(). It adds an RDF attribute
// to the image hook's variables.
$variables['attributes']['typeof'] = [
'foaf:Image',
];
}