/Drupal 8

function system_region_list

system_region_list($theme, $show = REGIONS_ALL)

Get a list of available regions from a specified theme.


\Drupal\Core\Extension\Extension|string $theme: A theme extension object, or 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'.


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


function system_region_list($theme, $show = REGIONS_ALL) {
  if (!$theme instanceof Extension) {
    $themes = \Drupal::service('theme_handler')->listInfo();
    if (!isset($themes[$theme])) {
      return array();
    $theme = $themes[$theme];
  $list = array();
  $info = $theme->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;

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.