8.3.x theme.api.php hook_preprocess(&$variables, $hook)
8.0.x theme.api.php hook_preprocess(&$variables, $hook)
8.1.x theme.api.php hook_preprocess(&$variables, $hook)
8.2.x theme.api.php hook_preprocess(&$variables, $hook)
8.4.x theme.api.php hook_preprocess(&$variables, $hook)
6.x core.php hook_preprocess(&$variables, $hook)
7.x theme.api.php hook_preprocess(&$variables, $hook)

Preprocess theme variables for template files.

This hook allows modules to preprocess theme variables for theme templates. It is only called for theme hooks implemented as template files, but not for those implemented as theme functions. The purpose of this hook is to allow modules to add to or override variables for all template files.

For more detailed information, see theme().


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

$hook: The name of the theme hook.

Related topics

2 functions implement hook_preprocess()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

search_invoke_preprocess in modules/search/search.module
Invokes hook_search_preprocess() in modules.
template_preprocess in includes/theme.inc
Adds a default set of helper variables for preprocess functions and templates. This comes in before any other preprocess function which makes it possible to be used in default theme implementations (non-overriden theme functions).


developer/hooks/core.php, line 2282
These are the hooks that are invoked by the Drupal core.


function hook_preprocess(&$variables, $hook) {
  // Add the name of the current theme hook as a variable
  $variables['theme_hook'] = $hook;