function Drupal::theme

Same name in other branches
  1. 9 core/lib/Drupal.php \Drupal::theme()
  2. 8.9.x core/lib/Drupal.php \Drupal::theme()
  3. 11.x core/lib/Drupal.php \Drupal::theme()

Gets the theme service.

Return value

\Drupal\Core\Theme\ThemeManagerInterface

5 calls to Drupal::theme()
RegistryTest::testMultipleSubThemes in core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php
Tests the theme registry with multiple subthemes.
RegistryTest::testSuggestionPreprocessFunctions in core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php
Tests the theme registry with suggestions.
RegistryTest::testThemeRegistryAlterByTheme in core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php
Tests that the theme registry can be altered by themes.
RegistryTest::testThemeTemplatesRegisteredByModules in core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php
Tests theme-provided templates that are registered by modules.
Stable9TemplateOverrideTest::testStable9TemplateOverrides in core/tests/Drupal/KernelTests/Core/Theme/Stable9TemplateOverrideTest.php
Ensures that Stable 9 overrides all relevant core templates.

File

core/lib/Drupal.php, line 651

Class

Drupal
Static Service Container wrapper.

Code

public static function theme() {
    return static::getContainer()->get('theme.manager');
}

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