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 @@ -111,6 +111,14 @@ $config_to_install = array_merge($config_to_install, $other_module_config); } + // Profiles can provide default configuration on behalf of other modules if + // the configuration already exists remove it as it was used when the + // extension that owns the configuration was installed. + if ($type == 'profile') { + $config_to_install = array_filter($config_to_install, function ($config_name) { + return !$this->activeStorage->exists($config_name); + }); + } return $config_to_install; } diff -u b/core/lib/Drupal/Core/Extension/ModuleHandler.php b/core/lib/Drupal/Core/Extension/ModuleHandler.php --- b/core/lib/Drupal/Core/Extension/ModuleHandler.php +++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php @@ -503,9 +503,9 @@ */ public function install(array $module_list, $enable_dependencies = TRUE) { $module_config = \Drupal::config('system.module'); + $module_data = system_rebuild_module_data(); if ($enable_dependencies) { // Get all module data so we can find dependencies and sort. - $module_data = system_rebuild_module_data(); $module_list = $module_list ? array_combine($module_list, $module_list) : array(); if (array_diff_key($module_list, $module_data)) { // One or more of the given modules doesn't exist. @@ -566,7 +566,7 @@ // Validate default configuration of this module. Bail if unable to // install. Should not continue installing more modules because those // may depend on this one. - if (!\Drupal::service('config.installer')->validatePreInstall('module', $module)) { + if (!\Drupal::service('config.installer')->validatePreInstall($module_data[$module]->getType(), $module)) { break; } @@ -644,7 +644,7 @@ } // Install default configuration of the module. - \Drupal::service('config.installer')->installDefaultConfig('module', $module); + \Drupal::service('config.installer')->installDefaultConfig($module_data[$module]->getType(), $module); // If the module has no current updates, but has some that were // previously removed, set the version to the value of only in patch2: unchanged: --- a/core/modules/field/lib/Drupal/field/Tests/FieldImportChangeTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldImportChangeTest.php @@ -15,6 +15,10 @@ class FieldImportChangeTest extends FieldUnitTestBase { /** * Modules to enable. * + * The default configuration provided by field_test_config is imported by + * \Drupal\field\Tests\FieldUnitTestBase::setUp() when it installs field + * configuration. + * * @var array */ public static $modules = array('field_test_config'); @@ -35,8 +39,6 @@ function testImportChange() { $instance_id = "entity_test.entity_test.$field_id"; $instance_config_name = "field.instance.$instance_id"; - // Import default config. - $this->installConfig(array('field_test_config')); $active = $this->container->get('config.storage'); $staging = $this->container->get('config.storage.staging'); $this->copyConfig($active, $staging); only in patch2: unchanged: --- a/core/modules/field/lib/Drupal/field/Tests/FieldImportDeleteTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldImportDeleteTest.php @@ -15,6 +15,10 @@ class FieldImportDeleteTest extends FieldUnitTestBase { /** * Modules to enable. * + * The default configuration provided by field_test_config is imported by + * \Drupal\field\Tests\FieldUnitTestBase::setUp() when it installs field + * configuration. + * * @var array */ public static $modules = array('field_test_config'); @@ -47,9 +51,6 @@ public function testImportDelete() { // Create a second bundle for the 'Entity test' entity type. entity_test_create_bundle('test_bundle_2'); - // Import default config. - $this->installConfig(array('field_test_config')); - // Get the uuid's for the fields. $field_uuid = entity_load('field_config', $field_id)->uuid(); $field_uuid_2 = entity_load('field_config', $field_id_2)->uuid();