function Registry::__construct

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

Constructs a \Drupal\Core\Theme\Registry object.

Parameters

string $root: The app root.

\Drupal\Core\Cache\CacheBackendInterface $cache: The cache backend interface to use for the complete theme registry data.

\Drupal\Core\Lock\LockBackendInterface $lock: The lock backend.

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler to use to load modules.

\Drupal\Core\Extension\ThemeHandlerInterface $theme_handler: The theme handler.

\Drupal\Core\Theme\ThemeInitializationInterface $theme_initialization: The theme initialization.

\Drupal\Core\Cache\CacheBackendInterface $runtime_cache: The cache backend interface to use for the runtime theme registry data.

\Drupal\Core\Extension\ModuleExtensionList $module_list: The module list.

string $theme_name: (optional) The name of the theme for which to construct the registry.

File

core/lib/Drupal/Core/Theme/Registry.php, line 188

Class

Registry
Defines the theme registry service.

Namespace

Drupal\Core\Theme

Code

public function __construct($root, CacheBackendInterface $cache, LockBackendInterface $lock, ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler, ThemeInitializationInterface $theme_initialization, $runtime_cache = NULL, $module_list = NULL, $theme_name = NULL) {
    if (!$runtime_cache instanceof CacheBackendInterface || !$module_list instanceof ModuleExtensionList) {
        @trigger_error('Calling Registry::__construct() without the $runtime_cache as an instance of CacheBackendInterface or the $module_list as an instance of ModuleExtensionList is deprecated in drupal:9.5.0 and is required in drupal:10.0.0. See https://www.drupal.org/node/3285131', E_USER_DEPRECATED);
        [
            $runtime_cache,
            $module_list,
            $theme_name,
        ] = [
            $module_list,
            $theme_name,
            $runtime_cache,
        ];
    }
    $this->root = $root;
    $this->cache = $cache;
    $this->lock = $lock;
    $this->moduleHandler = $module_handler;
    $this->themeHandler = $theme_handler;
    $this->themeInitialization = $theme_initialization;
    $this->runtimeCache = $runtime_cache;
    if (!$module_list) {
        @trigger_error('Calling Registry::__construct() without the $module_list argument is deprecated in drupal:9.3.0 and is required in drupal:10.0.0. See https://www.drupal.org/node/2940438', E_USER_DEPRECATED);
        $module_list = \Drupal::service('extension.list.module');
    }
    $this->moduleList = $module_list;
    $this->themeName = $theme_name;
}

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