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 @@ -117,13 +117,15 @@ $prefix = $name . '.'; } - // Gets profile storages to search for overrides if necessary. - $profile_storages = $this->getProfileStorages($name); + // Gets profile storages to search for overrides if necessary but only if + // the configuration is being installed outside of a profile/site + // installation. + $profile_storages = $profile_installation ? [] : $this->getProfileStorages($name); // Gather information about all the supported collections. $collection_info = $this->configManager->getConfigCollectionInfo(); foreach ($collection_info->getCollectionNames() as $collection) { - $config_to_create = $this->getConfigToCreate($storage, $collection, $prefix, $profile_storages, $profile_installation); + $config_to_create = $this->getConfigToCreate($storage, $collection, $prefix, $profile_storages); if (!empty($config_to_create)) { $this->createConfiguration($collection, $config_to_create); } @@ -236,30 +238,24 @@ * @param \Drupal\Core\Config\StorageInterface[] $profile_storages * An array of storage interfaces containing profile configuration to check * for overrides. - * @param bool $profile_installation - * (optional) Indicates whether profile installation is running. Defaults - * to FALSE. * * @return array * An array of configuration data read from the source storage keyed by the * configuration object name. */ - protected function getConfigToCreate(StorageInterface $storage, $collection, $prefix = '', array $profile_storages = [], $profile_installation = FALSE) { + protected function getConfigToCreate(StorageInterface $storage, $collection, $prefix = '', array $profile_storages = []) { if ($storage->getCollectionName() != $collection) { $storage = $storage->createCollection($collection); } $data = $storage->readMultiple($storage->listAll($prefix)); - if (!$profile_installation) { - // Check to see if the corresponding override storage has any overrides. - foreach ($profile_storages as $profile_storage) { - if ($profile_storage->getCollectionName() != $collection) { - $profile_storage = $profile_storage->createCollection($collection); - } - $data = $profile_storage->readMultiple(array_keys($data)) + $data; + // Check to see if the corresponding override storage has any overrides. + foreach ($profile_storages as $profile_storage) { + if ($profile_storage->getCollectionName() != $collection) { + $profile_storage = $profile_storage->createCollection($collection); } + $data = $profile_storage->readMultiple(array_keys($data)) + $data; } - return $data; } @@ -460,11 +456,13 @@ $enabled_extensions = $this->getEnabledExtensions(); // Add the extension that will be enabled to the list of enabled extensions. $enabled_extensions[] = $name; - // Gets profile storages to search for overrides if necessary. - $profile_storages = $this->getProfileStorages($name); + // Gets profile storages to search for overrides if necessary but only if + // the configuration is being installed outside of a profile/site + // installation. + $profile_storages = $profile_installation ? [] : $this->getProfileStorages($name); // Check the dependencies of configuration provided by the module. - list($invalid_default_config, $missing_dependencies) = $this->findDefaultConfigWithUnmetDependencies($storage, $enabled_extensions, $profile_storages, $profile_installation); + list($invalid_default_config, $missing_dependencies) = $this->findDefaultConfigWithUnmetDependencies($storage, $enabled_extensions, $profile_storages); if (!empty($invalid_default_config)) { throw UnmetDependenciesException::create($name, array_unique($missing_dependencies, SORT_REGULAR)); } @@ -499,9 +497,9 @@ * - An array that will be filled with the missing dependency names, keyed * by the dependents' names. */ - protected function findDefaultConfigWithUnmetDependencies(StorageInterface $storage, array $enabled_extensions, array $profile_storages = [], $profile_installation = FALSE) { + protected function findDefaultConfigWithUnmetDependencies(StorageInterface $storage, array $enabled_extensions, array $profile_storages = []) { $missing_dependencies = []; - $config_to_create = $this->getConfigToCreate($storage, StorageInterface::DEFAULT_COLLECTION, '', $profile_storages, $profile_installation); + $config_to_create = $this->getConfigToCreate($storage, StorageInterface::DEFAULT_COLLECTION, '', $profile_storages); $all_config = array_merge($this->configFactory->listAll(), array_keys($config_to_create)); foreach ($config_to_create as $config_name => $config) { if ($missing = $this->getMissingDependencies($config_name, $config, $enabled_extensions, $all_config)) {