Same name and namespace in other branches
  1. 6.x includes/theme.inc \theme_get_registry()
  2. 7.x includes/theme.inc \theme_get_registry()
  3. 8.9.x core/includes/theme.inc \theme_get_registry()
  4. 9 core/includes/theme.inc \theme_get_registry()

Gets the theme registry.

Parameters

bool $complete: Optional boolean to indicate whether to return the complete theme registry array or an instance of the Drupal\Core\Utility\ThemeRegistry class. If TRUE, the complete theme registry array will be returned. This is useful if you want to foreach over the whole registry, use array_* functions or inspect it in a debugger. If FALSE, an instance of the Drupal\Core\Utility\ThemeRegistry class will be returned, this provides an ArrayObject which allows it to be accessed with array syntax and isset(), and should be more lightweight than the full registry. Defaults to TRUE.

Return value

array|\Drupal\Core\Utility\ThemeRegistry The complete theme registry array, or an instance of the Drupal\Core\Utility\ThemeRegistry class.

Deprecated

in drupal:10.1.0 and is removed from drupal:11.0.0. Use theme.registry service methods get() or getRuntime() instead.

See also

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

1 call to theme_get_registry()
RegistryTest::testLegacyThemeGetRegistry in core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php
Tests deprecated theme_get_registry function.

File

core/includes/theme.inc, line 96
The theme system, which controls the output of Drupal.

Code

function theme_get_registry($complete = TRUE) {
  $theme_registry = \Drupal::service('theme.registry');
  if ($complete) {
    @trigger_error(__FUNCTION__ . '() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use theme.registry service method get() instead. See https://www.drupal.org/node/3348850', E_USER_DEPRECATED);
    return $theme_registry
      ->get();
  }
  else {
    @trigger_error(__FUNCTION__ . '() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use theme.registry service method getRuntime() instead. See https://www.drupal.org/node/3348850', E_USER_DEPRECATED);
    return $theme_registry
      ->getRuntime();
  }
}