system_find_base_theme
modules/system/system.module, строка 932
- Версии
- 6
system_find_base_theme($themes, $key, $used_keys = array())
Recursive function to find the top level base theme. Themes can inherit templates and function implementations from earlier themes.
Параметры
$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.
Возвращаемое значение
Returns the top level parent that has no ancestor or returns NULL
if there isn't a valid parent.
Код
<?php
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;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии