You are here

function system_region_list in Drupal 7

Same name and namespace in other branches
  1. 8 core/modules/system/system.module \system_region_list()
  2. 4 modules/system.module \system_region_list()
  3. 5 modules/system/system.module \system_region_list()
  4. 6 modules/system/system.module \system_region_list()
  5. 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.

$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()
block_admin_configure in modules/block/block.admin.inc
Form constructor for the block configuration form.
block_admin_display_form in modules/block/block.admin.inc
Form constructor for the main block administration form.
block_page_build in modules/block/block.module
Implements hook_page_build().
block_theme_initialize in modules/block/block.module
Assigns an initial, default set of blocks for a theme.
dashboard_admin_blocks in modules/dashboard/dashboard.module
Page callback: Builds the page for administering dashboard blocks.

... See full list

File

modules/system/system.module, line 2736
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;
}