Issue #3350904 by andypost, dww: Properly inject the theme registry in the ThemeInstaller
parent
947fd48d2b
commit
7c2e03b9ed
|
@ -639,7 +639,7 @@ services:
|
|||
Drupal\Core\Extension\ThemeHandlerInterface: '@theme_handler'
|
||||
theme_installer:
|
||||
class: Drupal\Core\Extension\ThemeInstaller
|
||||
arguments: ['@theme_handler', '@config.factory', '@config.installer', '@module_handler', '@config.manager', '@asset.css.collection_optimizer', '@router.builder', '@logger.channel.default', '@state', '@extension.list.module']
|
||||
arguments: ['@theme_handler', '@config.factory', '@config.installer', '@module_handler', '@config.manager', '@asset.css.collection_optimizer', '@router.builder', '@logger.channel.default', '@state', '@extension.list.module', '@theme.registry']
|
||||
Drupal\Core\Extension\ThemeInstallerInterface: '@theme_installer'
|
||||
entity.memory_cache:
|
||||
class: Drupal\Core\Cache\MemoryCache\MemoryCache
|
||||
|
|
|
@ -12,6 +12,7 @@ use Drupal\Core\Extension\Exception\UnknownExtensionException;
|
|||
use Drupal\Core\Routing\RouteBuilderInterface;
|
||||
use Drupal\Core\State\StateInterface;
|
||||
use Drupal\Core\StringTranslation\StringTranslationTrait;
|
||||
use Drupal\Core\Theme\Registry;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
|
@ -100,8 +101,10 @@ class ThemeInstaller implements ThemeInstallerInterface {
|
|||
* The state store.
|
||||
* @param \Drupal\Core\Extension\ModuleExtensionList $module_extension_list
|
||||
* The module extension list.
|
||||
* @param \Drupal\Core\Theme\Registry|null $themeRegistry
|
||||
* The theme registry.
|
||||
*/
|
||||
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) {
|
||||
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, protected ?Registry $themeRegistry = NULL) {
|
||||
$this->themeHandler = $theme_handler;
|
||||
$this->configFactory = $config_factory;
|
||||
$this->configInstaller = $config_installer;
|
||||
|
@ -112,6 +115,10 @@ class ThemeInstaller implements ThemeInstallerInterface {
|
|||
$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');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -307,7 +314,7 @@ class ThemeInstaller implements ThemeInstallerInterface {
|
|||
// @todo It feels wrong to have the requirement to clear the local tasks
|
||||
// cache here.
|
||||
Cache::invalidateTags(['local_task']);
|
||||
\Drupal::service('theme.registry')->reset();
|
||||
$this->themeRegistry->reset();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue