You are here

public function ConfigImporter::__construct in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Config/ConfigImporter.php \Drupal\Core\Config\ConfigImporter::__construct()

Constructs a configuration import object.

@todo Remove null default value https://www.drupal.org/node/2947083

Parameters

\Drupal\Core\Config\StorageComparerInterface $storage_comparer: A storage comparer object used to determine configuration changes and access the source and target storage objects.

\Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher: The event dispatcher used to notify subscribers of config import events.

\Drupal\Core\Config\ConfigManagerInterface $config_manager: The configuration manager.

\Drupal\Core\Lock\LockBackendInterface $lock: The lock backend to ensure multiple imports do not occur at the same time.

\Drupal\Core\Config\TypedConfigManagerInterface $typed_config: The typed configuration manager.

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler

\Drupal\Core\Extension\ModuleInstallerInterface $module_installer: The module installer.

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

\Drupal\Core\StringTranslation\TranslationInterface $string_translation: The string translation service.

\Drupal\Core\Extension\ModuleExtensionList|null $extension_list_module: The module extension list. This is left optional for BC reasons, but the optional usage is deprecated and will become required in Drupal 9.0.0.

File

core/lib/Drupal/Core/Config/ConfigImporter.php, line 197

Class

ConfigImporter
Defines a configuration importer.

Namespace

Drupal\Core\Config

Code

public function __construct(StorageComparerInterface $storage_comparer, EventDispatcherInterface $event_dispatcher, ConfigManagerInterface $config_manager, LockBackendInterface $lock, TypedConfigManagerInterface $typed_config, ModuleHandlerInterface $module_handler, ModuleInstallerInterface $module_installer, ThemeHandlerInterface $theme_handler, TranslationInterface $string_translation, ModuleExtensionList $extension_list_module = NULL) {
  if ($extension_list_module === NULL) {
    @trigger_error('Invoking the ConfigImporter constructor without the module extension list parameter is deprecated in Drupal 8.8.0 and will no longer be supported in Drupal 9.0.0. The extension list parameter is now required in the ConfigImporter constructor. See https://www.drupal.org/node/2943918', E_USER_DEPRECATED);
    $extension_list_module = \Drupal::service('extension.list.module');
  }
  $this->moduleExtensionList = $extension_list_module;
  $this->storageComparer = $storage_comparer;
  $this->eventDispatcher = $event_dispatcher;
  $this->configManager = $config_manager;
  $this->lock = $lock;
  $this->typedConfigManager = $typed_config;
  $this->moduleHandler = $module_handler;
  $this->moduleInstaller = $module_installer;
  $this->themeHandler = $theme_handler;
  $this->stringTranslation = $string_translation;
  foreach ($this->storageComparer
    ->getAllCollectionNames() as $collection) {
    $this->processedConfiguration[$collection] = $this->storageComparer
      ->getEmptyChangelist();
  }
  $this->processedExtensions = $this
    ->getEmptyExtensionsProcessedList();
}