1 theme.inc _theme_load_registry($theme, $base_themes = NULL, $theme_engine = NULL, $complete = TRUE)

Gets the theme_registry cache; if it doesn't exist, builds it.

Parameters

$theme: The loaded $theme object as returned by list_themes().

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

$theme_engine: The name of the theme engine.

$complete: Whether to load the complete theme registry or an instance of the ThemeRegistry class.

Return value

The theme registry array, or an instance of the ThemeRegistry class.:

File

core/includes/theme.inc, line 346
The theme system, which controls the output of Backdrop.

Code

function _theme_load_registry($theme, $base_themes = NULL, $theme_engine = NULL, $complete = TRUE) {
  if ($complete) {
    // Check the theme registry cache; if it exists, use it.
    $cached = cache()->get("theme_registry:$theme->name");
    if (isset($cached->data)) {
      $registry = $cached->data;
    }
    else {
      // If not, build one and cache it.
      $registry = _theme_build_registry($theme, $base_themes, $theme_engine);
      // Only persist this registry if all modules are loaded. This assures a
      // complete set of theme hooks.
      if (module_load_all(NULL)) {
        _theme_save_registry($theme, $registry);
      }
    }
    return $registry;
  }
  else {
    return new ThemeRegistry('theme_registry:runtime:' . $theme->name, 'cache');
  }
}