function hook_preprocess_HOOK

Same name in other branches
  1. 9 core/lib/Drupal/Core/Render/theme.api.php \hook_preprocess_HOOK()
  2. 8.9.x core/lib/Drupal/Core/Render/theme.api.php \hook_preprocess_HOOK()
  3. 10 core/lib/Drupal/Core/Render/theme.api.php \hook_preprocess_HOOK()
  4. 11.x 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 theme().

Parameters

$variables: The variables array (modify in place).

72 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 themes/bartik/template.php
Override or insert variables into the block template.
bartik_preprocess_html in themes/bartik/template.php
Add body classes if certain regions have content.
bartik_preprocess_maintenance_page in themes/bartik/template.php
Implements hook_preprocess_maintenance_page().
bartik_preprocess_node in themes/bartik/template.php
Override or insert variables into the node template.
garland_preprocess_block in themes/garland/template.php
Override or insert variables into the block template.

... See full list

File

modules/system/theme.api.php, line 159

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'] = array(
        'foaf:Image',
    );
}

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