function system_region_list
Same name and namespace in other branches
- 11.x core/modules/system/system.module \system_region_list()
- 10 core/modules/system/system.module \system_region_list()
- 9 core/modules/system/system.module \system_region_list()
- 8.9.x core/modules/system/system.module \system_region_list()
- 7.x modules/system/system.module \system_region_list()
Get a list of available regions from a specified theme.
Parameters
\Drupal\Core\Extension\Extension|string $theme: A theme extension object, or the name of a theme.
string $show: Possible values: REGIONS_ALL or REGIONS_VISIBLE. Visible excludes hidden regions.
Return value
string[] An array of regions in the form $region['name'] = 'description'.
Deprecated
in drupal:11.4.0 and is removed from drupal:13.0.0. Use \Drupal::service('theme_handler')->getTheme()->listAllRegions() or \Drupal::service('theme_handler')->getTheme()->listVisibleRegions() instead.
See also
https://www.drupal.org/node/3015925
1 call to system_region_list()
- ThemeRegionTest::testLegacyRegionListing in core/
tests/ Drupal/ KernelTests/ Core/ Theme/ ThemeRegionTest.php - Tests listing a theme's regions using legacy functions.
File
-
core/
modules/ system/ system.module, line 134
Code
function system_region_list($theme, $show = REGIONS_ALL) : array {
@trigger_error("system_region_list() is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. Use \\Drupal::service('theme_handler')->getTheme()->listAllRegions() or \\Drupal::service('theme_handler')->getTheme()->listVisibleRegions() instead. See https://www.drupal.org/node/3015925", E_USER_DEPRECATED);
if (!$theme instanceof Theme) {
// For true backwards-compatibility we have to handle the case where this is
// passed an extension object created before it has been processed by the
// theme handler.
if ($theme instanceof Extension) {
$theme = $theme->getName();
}
try {
/** @var \Drupal\core\Extension\Theme $theme */
$theme = \Drupal::service('theme_handler')->getTheme($theme);
} catch (UnknownExtensionException) {
return [];
}
}
if ($show === REGIONS_VISIBLE) {
return $theme->listVisibleRegions();
}
return $theme->listAllRegions();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.