You are here

function _theme_build_registry in Drupal 6

Same name and namespace in other branches
  1. 7 includes/theme.inc \_theme_build_registry()

Rebuild the hook theme_registry cache.

Parameters

$theme: The loaded $theme object.

$base_theme: An array of loaded $theme objects representing the ancestor themes in oldest first order.

theme_engine: The name of the theme engine.

2 calls to _theme_build_registry()
_theme_load_offline_registry in includes/theme.maintenance.inc
This builds the registry when the site needs to bypass any database calls.
_theme_load_registry in includes/theme.inc
Get the theme_registry cache from the database; if it doesn't exist, build it.

File

includes/theme.inc, line 428
The theme system, which controls the output of Drupal.

Code

function _theme_build_registry($theme, $base_theme, $theme_engine) {
  $cache = array();

  // First, process the theme hooks advertised by modules. This will
  // serve as the basic registry.
  foreach (module_implements('theme') as $module) {
    _theme_process_registry($cache, $module, 'module', $module, drupal_get_path('module', $module));
  }

  // Process each base theme.
  foreach ($base_theme as $base) {

    // If the base theme uses a theme engine, process its hooks.
    $base_path = dirname($base->filename);
    if ($theme_engine) {
      _theme_process_registry($cache, $theme_engine, 'base_theme_engine', $base->name, $base_path);
    }
    _theme_process_registry($cache, $base->name, 'base_theme', $base->name, $base_path);
  }

  // And then the same thing, but for the theme.
  if ($theme_engine) {
    _theme_process_registry($cache, $theme_engine, 'theme_engine', $theme->name, dirname($theme->filename));
  }

  // Finally, hooks provided by the theme itself.
  _theme_process_registry($cache, $theme->name, 'theme', $theme->name, dirname($theme->filename));

  // Let modules alter the registry
  drupal_alter('theme_registry', $cache);
  return $cache;
}