function hook_template_preprocess_default_variables_alter

Alter the default, hook-independent variables for all templates.

Allows modules to provide additional default template variables or manipulate existing. This hook is invoked from template_preprocess() after basic default template variables have been set up and before the next template preprocess function is invoked.

Note that the default template variables are statically cached within a request. When adding a template variable that depends on other context, it is your responsibility to appropriately reset the static cache in template_preprocess() when needed:

drupal_static_reset('template_preprocess');

See user_template_preprocess_default_variables_alter() for an example.

Parameters

array $variables: An associative array of default template variables, as set up by _template_preprocess_default_variables(). Passed by reference.

See also

template_preprocess()

_template_preprocess_default_variables()

Related topics

1 function implements hook_template_preprocess_default_variables_alter()

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

user_template_preprocess_default_variables_alter in drupal/core/modules/user/user.module
Implements hook_template_preprocess_default_variables_alter().
1 invocation of hook_template_preprocess_default_variables_alter()
_template_preprocess_default_variables in drupal/core/includes/theme.inc
Returns hook-independent variables to template_preprocess().

File

drupal/core/modules/system/system.api.php, line 1738
Hooks provided by Drupal core and the System module.

Code

function hook_template_preprocess_default_variables_alter(&$variables) {
  $variables['is_admin'] = user_access('access administration pages');
}