function system_region_list in Drupal 4
Same name and namespace in other branches
- 8 core/modules/system/system.module \system_region_list()
- 5 modules/system/system.module \system_region_list()
- 6 modules/system/system.module \system_region_list()
- 7 modules/system/system.module \system_region_list()
- 9 core/modules/system/system.module \system_region_list()
Get a list of available regions from a specified theme.
Parameters
$theme_key: The name of a theme.
Return value
An array of regions in the form $region['name'] = 'description'.
5 calls to system_region_list()
- block_admin_display in modules/
block.module - Generate main block administration form.
- system_default_region in modules/
system.module - Get the name of the default region for a given theme.
- system_initialize_theme_blocks in modules/
system.module - Assign an initial, default set of blocks for a theme.
- theme_block_admin_display in modules/
block.module - Theme main block administration form submission.
- _phptemplate_default_variables in themes/
engines/ phptemplate/ phptemplate.engine - Adds additional helper variables to all templates.
File
- modules/
system.module, line 629 - Configuration system that lets administrators modify the workings of the site.
Code
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');
}
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];
}