function drupal_find_base_themes

Find all the base themes for the specified 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 an array of all of the theme's ancestors; the first element's value will be NULL if an error occurred.

3 calls to drupal_find_base_themes()
system_find_base_themes in modules/system/system.module
Find all the base themes for the specified theme.
system_list in includes/module.inc
Builds a list of bootstrap modules and enabled modules and themes.
_system_rebuild_theme_data in modules/system/system.module
Helper function to scan and collect theme .info data and their engines.

File

includes/theme.inc, line 843

Code

function drupal_find_base_themes($themes, $key, $used_keys = array()) {
    $base_key = $themes[$key]->info['base theme'];
    // Does the base theme exist?
    if (!isset($themes[$base_key])) {
        return array(
            $base_key => NULL,
        );
    }
    $current_base_theme = array(
        $base_key => $themes[$base_key]->info['name'],
    );
    // Is the base theme itself a child of another theme?
    if (isset($themes[$base_key]->info['base theme'])) {
        // Do we already know the base themes of this theme?
        if (isset($themes[$base_key]->base_themes)) {
            return $themes[$base_key]->base_themes + $current_base_theme;
        }
        // Prevent loops.
        if (!empty($used_keys[$base_key])) {
            return array(
                $base_key => NULL,
            );
        }
        $used_keys[$base_key] = TRUE;
        return drupal_find_base_themes($themes, $base_key, $used_keys) + $current_base_theme;
    }
    // If we get here, then this is our parent theme.
    return $current_base_theme;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.