diff --git a/core/lib/Drupal/Core/Config/ConfigInstaller.php b/core/lib/Drupal/Core/Config/ConfigInstaller.php index 242d92097e..1cbf47fc40 100644 --- a/core/lib/Drupal/Core/Config/ConfigInstaller.php +++ b/core/lib/Drupal/Core/Config/ConfigInstaller.php @@ -126,10 +126,8 @@ public function installDefaultConfig($type, $name) { $config_to_create = $this->getConfigToCreate($storage, $collection, $prefix, $profile_storages); // If we're installing a profile ensure configuration that is overriding // is excluded. - if ($name == $this->drupalGetProfile()) { - $existing_configuration = $this->getActiveStorages($collection)->listAll(); - $config_to_create = array_diff_key($config_to_create, array_flip($existing_configuration)); - } + // @todo Exclude simple configuration that already exists because it + // will have been imported already. if (!empty($config_to_create)) { $this->createConfiguration($collection, $config_to_create); } @@ -258,7 +256,22 @@ protected function getConfigToCreate(StorageInterface $storage, $collection, $pr if ($profile_storage->getCollectionName() != $collection) { $profile_storage = $profile_storage->createCollection($collection); } - $data = $profile_storage->readMultiple(array_keys($data)) + $data; + $profile_overrides = $profile_storage->readMultiple(array_keys($data)); + if ($this->drupalInstallationAttempted()) { + // During installation profile provided configuration overrides can have + // dependencies that can not possibly be installed. Therefore, only + // override simple configuration. + foreach ($profile_overrides as $name => $override_data) { + if (!isset($override_data['dependencies'])) { + $data[$name] = $override_data; + } + } + } + else { + // Allow install profiles to override configuration when installing + // extension after Drupal installation. + $data = $profile_overrides + $data; + } } return $data; }