You are here

public function ThemeInstaller::__construct in Drupal 9

Same name and namespace in other branches
  1. 8 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 104

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;
}