function ThemeInstaller::__construct

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

Constructs a new ThemeInstaller.

Parameters

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

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The config factory to get the installed themes.

\Drupal\Core\Config\ConfigInstallerInterface $config_installer: (optional) The config installer to install configuration. This optional to allow the theme handler to work before Drupal is installed and has a database.

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler to fire themes_installed/themes_uninstalled hooks.

\Drupal\Core\Config\ConfigManagerInterface $config_manager: The config manager used to uninstall a theme.

\Drupal\Core\Asset\AssetCollectionOptimizerInterface $css_collection_optimizer: The CSS asset collection optimizer service.

\Drupal\Core\Routing\RouteBuilderInterface $route_builder: (optional) The route builder service to rebuild the routes if a theme is installed.

\Psr\Log\LoggerInterface $logger: A logger instance.

\Drupal\Core\State\StateInterface $state: The state store.

\Drupal\Core\Extension\ModuleExtensionList $module_extension_list: The module extension list.

\Drupal\Core\Theme\Registry|null $themeRegistry: The theme registry.

\Drupal\Core\Extension\ThemeExtensionList|null $themeExtensionList: The theme extension list.

File

core/lib/Drupal/Core/Extension/ThemeInstaller.php, line 108

Class

ThemeInstaller
Manages theme installation/uninstallation.

Namespace

Drupal\Core\Extension

Code

public function __construct(ThemeHandlerInterface $theme_handler, ConfigFactoryInterface $config_factory, ConfigInstallerInterface $config_installer, ModuleHandlerInterface $module_handler, ConfigManagerInterface $config_manager, AssetCollectionOptimizerInterface $css_collection_optimizer, RouteBuilderInterface $route_builder, LoggerInterface $logger, StateInterface $state, ModuleExtensionList $module_extension_list, ?Registry $themeRegistry = NULL, ?ThemeExtensionList $themeExtensionList = NULL) {
    $this->themeHandler = $theme_handler;
    $this->configFactory = $config_factory;
    $this->configInstaller = $config_installer;
    $this->moduleHandler = $module_handler;
    $this->configManager = $config_manager;
    $this->cssCollectionOptimizer = $css_collection_optimizer;
    $this->routeBuilder = $route_builder;
    $this->logger = $logger;
    $this->state = $state;
    $this->moduleExtensionList = $module_extension_list;
    if ($this->themeRegistry === NULL) {
        @trigger_error('Calling ' . __METHOD__ . '() without the $themeRegistry argument is deprecated in drupal:10.1.0 and will be required in drupal:11.0.0. See https://www.drupal.org/node/3350906', E_USER_DEPRECATED);
        $this->themeRegistry = \Drupal::service('theme.registry');
    }
    if ($this->themeExtensionList === NULL) {
        @trigger_error('Calling ' . __METHOD__ . '() without the $themeExtensionList argument is deprecated in drupal:10.3.0 and will be required in drupal:11.0.0. See https://www.drupal.org/node/3413308', E_USER_DEPRECATED);
        $this->themeExtensionList = \Drupal::service('extension.list.theme');
    }
}

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