1 system.api.php hook_theme_registry_alter(&$theme_registry)

Alter the theme registry information returned from hook_theme().

The theme registry stores information about all available theme hooks, including which callback functions those hooks will call when triggered, what template files are exposed by these hooks, and so on.

Note that this hook is only executed as the theme cache is re-built. Changes here will not be visible until the next cache clear.

The $theme_registry array is keyed by theme hook name, and contains the information returned from hook_theme(), as well as additional properties added by _theme_process_registry().

For example:

$theme_registry['user_profile'] = array(
  'variables' => array(
    'account' => NULL,
  ),
  'template' => 'core/modules/user/user-profile',
  'file' => 'core/modules/user/user.pages.inc',
  'type' => 'module',
  'theme path' => 'core/modules/user',
  'preprocess functions' => array(
    0 => 'template_preprocess',
    1 => 'template_preprocess_user_profile',
  ),
);

Parameters

$theme_registry: The entire cache of theme registry information, post-processing.

See also

hook_theme()

_theme_process_registry()

Related topics

File

core/modules/system/system.api.php, line 1759
Hooks provided by Backdrop core and the System module.

Code

function hook_theme_registry_alter(&$theme_registry) {
  // Remove the base preprocess function for nodes.
  foreach ($theme_registry['node']['preprocess functions'] as $key => $value) {
    if ($value == 'template_preprocess_node') {
      unset($theme_registry['node']['preprocess functions'][$key]);
    }
  }
}