function system_region_list

Get a list of available regions from a specified theme.

Parameters

$theme_key: The name of a theme.

$show: Possible values: REGIONS_ALL or REGIONS_VISIBLE. Visible excludes hidden regions.

bool $labels: (optional) Boolean to specify whether the human readable machine names should be returned or not. Defaults to TRUE, but calling code can set this to FALSE for better performance, if it only needs machine names.

Return value

array An associative array of regions in the form $region['name'] = 'description' if $labels is set to TRUE, or $region['name'] = 'name', if $labels is set to FALSE.

12 calls to system_region_list()

File

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

Code

function system_region_list($theme_key, $show = REGIONS_ALL, $labels = TRUE) {
  $themes = list_themes();
  if (!isset($themes[$theme_key])) {
    return array();
  }
  $list = array();
  $info = $themes[$theme_key]->info;

  // If requested, suppress hidden regions. See block_admin_display_form().
  foreach ($info['regions'] as $name => $label) {
    if ($show == REGIONS_ALL || !isset($info['regions_hidden']) || !in_array($name, $info['regions_hidden'])) {
      if ($labels) {
        $list[$name] = t($label);
      }
      else {
        $list[$name] = $name;
      }
    }
  }
  return $list;
}