system_region_list($theme, $show = REGIONS_ALL)
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.
$show: Possible values: REGIONS_ALL or REGIONS_VISIBLE. Visible excludes hidden regions.
Return value
An array of regions in the form $region['name'] = 'description'.
File
- core/modules/system/system.module, line 1107
- Configuration system that lets administrators modify the workings of the site.
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 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 ; } |
Please login to continue.