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.

Return value

An array of regions in the form $region['name'] = 'description'.

10 calls to system_region_list()
BlockFormController::form in drupal/core/modules/block/lib/Drupal/block/BlockFormController.php
Overrides \Drupal\Core\Entity\EntityFormController::form().
BlockListController::load in drupal/core/modules/block/lib/Drupal/block/BlockListController.php
Overrides \Drupal\Core\Config\Entity\ConfigEntityListController::load().
block_page_build in drupal/core/modules/block/block.module
Implements hook_page_build().
block_theme_initialize in drupal/core/modules/block/block.module
Assigns an initial, default set of blocks for a theme.
InfoAlterTest::testSystemInfoAlter in drupal/core/modules/system/lib/Drupal/system/Tests/System/InfoAlterTest.php
Tests that theme .info.yml data is rebuild after enabling a module.

... See full list

File

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

Code

function system_region_list($theme_key, $show = REGIONS_ALL) {
  $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'])) {
      $list[$name] = t($label);
    }
  }
  return $list;
}