diff -u b/core/lib/Drupal/Core/Config/ConfigFactoryOverrideInterface.php b/core/lib/Drupal/Core/Config/ConfigFactoryOverrideInterface.php --- b/core/lib/Drupal/Core/Config/ConfigFactoryOverrideInterface.php +++ b/core/lib/Drupal/Core/Config/ConfigFactoryOverrideInterface.php @@ -33,7 +33,20 @@ public function getCacheSuffix(); /** - * Gets a configuration object for the override. + * Creates a configuration object for use during install and synchronization. + * + * If the overrider stores it's overrides in configuration collections then + * it can have its own implementation of + * \Drupal\Core\Config\StorableConfigBase. Configuration overrider's can link + * themselves to a configuration collection by listening to the + * \Drupal\Core\Config\ConfigEvents::COLLECTION_INFO event and adding the + * collections they are responsible for. Doing this will allow installation + * and synchronization to use the overrider's implementation of + * StorableConfigBase. + * + * @see \Drupal\Core\Config\ConfigCollectionInfo + * @see \Drupal\Core\Config\ConfigImporter::importConfig() + * @see \Drupal\Core\Config\ConfigInstaller::createConfiguration() * * @param string $name * The configuration object name. diff -u b/core/lib/Drupal/Core/Config/ConfigImporter.php b/core/lib/Drupal/Core/Config/ConfigImporter.php --- b/core/lib/Drupal/Core/Config/ConfigImporter.php +++ b/core/lib/Drupal/Core/Config/ConfigImporter.php @@ -896,7 +896,15 @@ * The name of the configuration to process. */ protected function importConfig($collection, $op, $name) { - $config = $this->configManager->createConfigObject($name, $collection); + // Allow config factory overriders to use a custom configuration object if + // they are responsible for the collection. + $overrider = $this->configManager->getConfigCollectionInfo()->getOverrideService($collection); + if ($overrider) { + $config = $overrider->createConfigObject($name, $collection); + } + else { + $config = new Config($name, $this->storageComparer->getTargetStorage($collection), $this->eventDispatcher, $this->typedConfigManager); + } if ($op == 'delete') { $config->delete(); } diff -u b/core/lib/Drupal/Core/Config/ConfigInstaller.php b/core/lib/Drupal/Core/Config/ConfigInstaller.php --- b/core/lib/Drupal/Core/Config/ConfigInstaller.php +++ b/core/lib/Drupal/Core/Config/ConfigInstaller.php @@ -183,7 +183,15 @@ $config_to_install = array_diff($config_to_install, $this->getActiveStorage($collection)->listAll()); foreach ($config_to_install as $name) { - $new_config = $this->configManager->createConfigObject($name, $collection); + // Allow config factory overriders to use a custom configuration object if + // they are responsible for the collection. + $overrider = $this->configManager->getConfigCollectionInfo()->getOverrideService($collection); + if ($overrider) { + $new_config = $overrider->createConfigObject($name, $collection); + } + else { + $new_config = new Config($name, $this->getActiveStorage($collection), $this->eventDispatcher, $this->typedConfig); + } if ($data[$name] !== FALSE) { $new_config->setData($data[$name]); } diff -u b/core/lib/Drupal/Core/Config/ConfigManager.php b/core/lib/Drupal/Core/Config/ConfigManager.php --- b/core/lib/Drupal/Core/Config/ConfigManager.php +++ b/core/lib/Drupal/Core/Config/ConfigManager.php @@ -287,36 +287,2 @@ - /** - * {$inheritdoc} - */ - public function createConfigObject($name, $collection) { - $overrider = $this->getConfigCollectionInfo()->getOverrideService($collection); - if ($overrider) { - $config = $overrider->createConfigObject($name, $collection); - } - else { - $config = new Config($name, $this->getStorageCollection($collection), $this->eventDispatcher, $this->typedConfigManager); - } - return $config; - } - - /** - * Gets the configuration storage that provides the active configuration. - * - * @param string $collection - * The configuration collection. - * - * @return \Drupal\Core\Config\StorageInterface - * The configuration storage for the provided collection. - */ - protected function getStorageCollection($collection) { - if (!isset($this->storages[$collection])) { - if ($this->activeStorage->getCollectionName() == $collection) { - $this->storages[$collection] = $this->activeStorage; - } - else { - $this->storages[$collection] = $this->activeStorage->createCollection($collection); - } - } - return $this->storages[$collection]; - } } diff -u b/core/lib/Drupal/Core/Config/ConfigManagerInterface.php b/core/lib/Drupal/Core/Config/ConfigManagerInterface.php --- b/core/lib/Drupal/Core/Config/ConfigManagerInterface.php +++ b/core/lib/Drupal/Core/Config/ConfigManagerInterface.php @@ -133,15 +133,2 @@ - /** - * Creates a StorableConfigBase object according to the needs of the collection. - * - * @param string $name - * The configuration object name. - * @param string $collection - * The configuration collection. - * - * @return \Drupal\Core\Config\StorableConfigBase - * The configuration object. - */ - public function createConfigObject($name, $collection); - }