/Drupal 8

function hook_theme_registry_alter


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 \Drupal\Core\Theme\Registry::processExtension().

For example:

$theme_registry['block_content_add_list'] = array (
  'template' => 'block-content-add-list',
  'path' => 'core/themes/seven/templates',
  'type' => 'theme_engine',
  'theme path' => 'core/themes/seven',
  'includes' => array (
    0 => 'core/modules/block_content/block_content.pages.inc',
  'variables' => array (
    'content' => NULL,
  'preprocess functions' => array (
    0 => 'template_preprocess',
    1 => 'template_preprocess_block_content_add_list',
    2 => 'contextual_preprocess',
    3 => 'seven_preprocess_block_content_add_list',


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

See also



Related topics

Define functions that alter the behavior of Drupal core.


core/lib/Drupal/Core/Render/theme.api.php, line 1241
Hooks and documentation related to the theme and render system.


function hook_theme_registry_alter(&$theme_registry) {
  // Kill the next/previous forum topic navigation links.
  foreach ($theme_registry['forum_topic_navigation']['preprocess functions'] as $key => $value) {
    if ($value == 'template_preprocess_forum_topic_navigation') {
      unset($theme_registry['forum_topic_navigation']['preprocess functions'][$key]);

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.