function ThemeInstaller::__construct

Same name in other branches
  1. 9 core/lib/Drupal/Core/Extension/ThemeInstaller.php \Drupal\Core\Extension\ThemeInstaller::__construct()
  2. 10 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.

File

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

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 = 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;
    if ($module_extension_list === NULL) {
        @trigger_error('The extension.list.module service must be passed to ' . __NAMESPACE__ . '\\ThemeInstaller::__construct(). It was added in drupal:8.9.0 and will be required before drupal:10.0.0.', E_USER_DEPRECATED);
        $module_extension_list = \Drupal::service('extension.list.module');
    }
    $this->moduleExtensionList = $module_extension_list;
}

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