You are here

function system_find_base_theme in Drupal 6

This function has been deprecated in favor of system_find_base_themes().

Recursive function to find the top level base theme. Themes can inherit templates and function implementations from earlier themes.

Parameters

$themes: An array of available themes.

$key: The name of the theme whose base we are looking for.

$used_keys: A recursion parameter preventing endless loops.

Return value

Returns the top level parent that has no ancestor or returns NULL if there isn't a valid parent.

File

modules/system/system.module, line 1017
Configuration system that lets administrators modify the workings of the site.

Code

function system_find_base_theme($themes, $key, $used_keys = array()) {
  $base_key = $themes[$key]->info['base theme'];

  // Does the base theme exist?
  if (!isset($themes[$base_key])) {
    return NULL;
  }

  // Is the base theme itself a child of another theme?
  if (isset($themes[$base_key]->info['base theme'])) {

    // Prevent loops.
    if (!empty($used_keys[$base_key])) {
      return NULL;
    }
    $used_keys[$base_key] = TRUE;
    return system_find_base_theme($themes, $base_key, $used_keys);
  }

  // If we get here, then this is our parent theme.
  return $base_key;
}