function ThemeManager::__construct

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Theme/ThemeManager.php \Drupal\Core\Theme\ThemeManager::__construct()
  2. 10 core/lib/Drupal/Core/Theme/ThemeManager.php \Drupal\Core\Theme\ThemeManager::__construct()
  3. 9 core/lib/Drupal/Core/Theme/ThemeManager.php \Drupal\Core\Theme\ThemeManager::__construct()
  4. 8.9.x core/lib/Drupal/Core/Theme/ThemeManager.php \Drupal\Core\Theme\ThemeManager::__construct()

File

core/lib/Drupal/Core/Theme/ThemeManager.php, line 58

Class

ThemeManager
Provides the default implementation of a theme manager.

Namespace

Drupal\Core\Theme

Code

public function __construct(#[Autowire(param: 'app.root')] protected string $root, protected ThemeNegotiatorInterface $themeNegotiator, protected ThemeInitializationInterface $themeInitialization, protected ModuleHandlerInterface $moduleHandler, protected CallableResolver $callableResolver, #[AutowireLocator('theme_engine', 'engine_name')] protected ServiceCollectionInterface $themeEngines, protected ?KeyValueFactoryInterface $keyValueFactory = NULL, #[Autowire(service: 'cache.bootstrap')] protected ?CacheBackendInterface $cache = NULL) {
  if ($this->keyValueFactory === NULL) {
    @trigger_error('Calling ' . __METHOD__ . ' without the $keyValueFactory argument is deprecated in drupal:11.3.0 and it will be required in drupal:12.0.0. See https://www.drupal.org/node/3551652', E_USER_DEPRECATED);
    $this->keyValueFactory = \Drupal::service('keyvalue');
  }
  if ($this->cache === NULL) {
    @trigger_error('Calling ' . __METHOD__ . ' without the $cache argument is deprecated in drupal:11.3.0 and it will be required in drupal:12.0.0. See https://www.drupal.org/node/3551652', E_USER_DEPRECATED);
    $this->cache = \Drupal::service('cache.bootstrap');
  }
}

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