system_region_list
modules/system/system.module, строка 996
- Версии
- 5 – 6
system_region_list($theme_key)
Get a list of available regions from a specified theme.
Параметры
$theme_key
The name of a theme.
Возвращаемое значение
An array of regions in the form $region['name']
= 'description'
.
Код
<?php
function system_region_list($theme_key) {
static $list = array();
if (!array_key_exists($theme_key, $list)) {
$theme = db_fetch_object(db_query("SELECT * FROM {system} WHERE type = 'theme' AND name = '%s'", $theme_key));
// Stylesheets can't have regions; use its theme.
if (strpos($theme->filename, '.css')) {
return system_region_list(basename(dirname($theme->description)));
}
// If this is a custom theme, load it in before moving on.
if (file_exists($file = dirname($theme->filename) .'/'. $theme_key .'.theme')) {
include_once "./$file";
}
$regions = array();
// This theme has defined its own regions.
if (function_exists($theme_key .'_regions')) {
$regions = call_user_func($theme_key .'_regions');
}
// File is an engine; include its regions.
else if (strpos($theme->description, '.engine')) {
include_once './'. $theme->description;
$theme_engine = basename($theme->description, '.engine');
$regions = function_exists($theme_engine .'_regions') ? call_user_func($theme_engine .'_regions') : array();
}
$list[$theme_key] = $regions;
}
return $list[$theme_key];
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии