function system_default_region

Same name and namespace in other branches
  1. 11.x core/modules/system/system.module \system_default_region()
  2. 10 core/modules/system/system.module \system_default_region()
  3. 9 core/modules/system/system.module \system_default_region()
  4. 8.9.x core/modules/system/system.module \system_default_region()
  5. 7.x modules/system/system.module \system_default_region()

Gets the name of the default region for a given theme.

Parameters

string $theme: The name of a theme.

Return value

string A string that is the region name.

Deprecated

in drupal:11.4.0 and is removed from drupal:13.0.0. Use \Drupal::service('theme_handler')->getTheme()->getDefaultRegion() instead.

See also

https://www.drupal.org/node/3015925

1 call to system_default_region()
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 196

Code

function system_default_region($theme) {
  @trigger_error("system_default_region() is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. Use \\Drupal::service('theme_handler')->getTheme()->getDefaultRegion() instead. See https://www.drupal.org/node/3015925", E_USER_DEPRECATED);
  try {
    /** @var \Drupal\core\Extension\Theme $theme */
    $theme = \Drupal::service('theme_handler')->getTheme($theme);
  } catch (UnknownExtensionException) {
    return '';
  }
  return $theme->getDefaultRegion();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.