function hook_preprocess_HOOK

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

42 functions implement hook_preprocess_HOOK()

Note: the procedural functions in this list are found by pattern matching, so the list may include some functions that are not actually implementations of this hook.

search_embedded_form_preprocess_search_result in modules/search/tests/search_embedded_form.module
Adds the test form to search results.
system_preprocess_block in modules/system/system.module
Implements hook_preprocess_block().
template_preprocess_aggregator_feed_source in modules/aggregator/aggregator.pages.inc
Processes variables for aggregator-feed-source.tpl.php.
template_preprocess_aggregator_item in modules/aggregator/aggregator.pages.inc
Processes variables for aggregator-item.tpl.php.
template_preprocess_aggregator_summary_item in modules/aggregator/aggregator.pages.inc
Processes variables for aggregator-summary-item.tpl.php.

... 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.