diff --git a/core/lib/Drupal/Core/Config/ConfigInstaller.php b/core/lib/Drupal/Core/Config/ConfigInstaller.php index 50aa8a5..31ec2d0 100644 --- a/core/lib/Drupal/Core/Config/ConfigInstaller.php +++ b/core/lib/Drupal/Core/Config/ConfigInstaller.php @@ -92,40 +92,36 @@ public function installDefaultConfig($type, $name) { $source_storage = $this->getSourceStorage(); $config_to_install = $source_storage->listAll($name . '.'); - // Work out if this extension provides default configuration for any other - // enabled extensions. - $config_dir = drupal_get_path($type, $name) . '/config'; - $config_install_dir = $config_dir . '/install'; - if (is_dir($config_dir)) { - if (is_dir($config_dir . '/schema')) { - // Refresh the schema cache if installing default configuration and the - // extension has a configuration schema directory. - $this->typedConfig->clearCachedDefinitions(); - } - // If not installing the core base system default configuration, retrieve - // the list of integration configuration of currently enabled extensions. - if ($type !== 'core') { - $enabled_extensions = $other_module_config = array(); - if (is_dir($config_install_dir)) { - $default_storage = new FileStorage($config_install_dir); - $other_module_config = array_filter($default_storage->listAll(), function ($value) use ($name) { - return !preg_match('/^' . $name . '\./', $value); - }); - } - - // Read enabled extensions directly from configuration to avoid circular - // dependencies with ModuleHandler and ThemeHandler. - $extension_config = $this->configFactory->get('core.extension'); - $enabled_extensions += array_keys((array) $extension_config->get('module')); - $enabled_extensions += array_keys((array) $extension_config->get('theme')); - - $other_module_config = array_filter($other_module_config, function ($config_name) use ($enabled_extensions) { - $provider = Unicode::substr($config_name, 0, strpos($config_name, '.')); - return in_array($provider, $enabled_extensions); - }); + $extension_path = drupal_get_path($type, $name); + // If the module provides configuration schema clear the definitions. + if (is_dir($extension_path . '/' . InstallStorage::CONFIG_SCHEMA_DIRECTORY)) { + // Refresh the schema cache if installing default configuration and the + // extension has a configuration schema directory. + $this->typedConfig->clearCachedDefinitions(); + } - $config_to_install = array_merge($config_to_install, $other_module_config); - } + // If not installing the core base system default configuration, work out if + // this extension provides default configuration for any other enabled + // extensions. + if ($type !== 'core' && is_dir($extension_path . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY)) { + $enabled_extensions = $other_module_config = array(); + $default_storage = new FileStorage($extension_path . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY); + $other_module_config = array_filter($default_storage->listAll(), function ($value) use ($name) { + return !preg_match('/^' . $name . '\./', $value); + }); + + // Read enabled extensions directly from configuration to avoid circular + // dependencies with ModuleHandler and ThemeHandler. + $extension_config = $this->configFactory->get('core.extension'); + $enabled_extensions += array_keys((array) $extension_config->get('module')); + $enabled_extensions += array_keys((array) $extension_config->get('theme')); + + $other_module_config = array_filter($other_module_config, function ($config_name) use ($enabled_extensions) { + $provider = Unicode::substr($config_name, 0, strpos($config_name, '.')); + return in_array($provider, $enabled_extensions); + }); + + $config_to_install = array_merge($config_to_install, $other_module_config); } if (!empty($config_to_install)) { diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php index f10a120..dc6de36 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php @@ -9,6 +9,7 @@ use Drupal\Component\Utility\String; use Drupal\Core\Config\ConfigNameException; +use Drupal\Core\Config\InstallStorage; use Drupal\simpletest\DrupalUnitTestBase; use Drupal\Core\Config\FileStorage; use Drupal\Core\Config\DatabaseStorage; @@ -196,7 +197,7 @@ public function testDataTypes() { $storage = new DatabaseStorage($this->container->get('database'), 'config'); $name = 'config_test.types'; $config = $this->container->get('config.factory')->get($name); - $original_content = file_get_contents(drupal_get_path('module', 'config_test') . "/config/$name.yml"); + $original_content = file_get_contents(drupal_get_path('module', 'config_test') . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY . "/$name.yml"); $this->verbose('
' . $original_content . "\n" . var_export($storage->read($name), TRUE));
 
     // Verify variable data types are intact.
diff --git a/core/modules/config/tests/config_test_invalid_name/config_test_invalid_name.info.yml b/core/modules/config/tests/config_test_invalid_name/install
similarity index 100%
rename from core/modules/config/tests/config_test_invalid_name/config_test_invalid_name.info.yml
rename to core/modules/config/tests/config_test_invalid_name/install
diff --git a/core/modules/menu_ui/config/menu_ui.settings.yml b/core/modules/menu_ui/config/install/menu_ui.settings.yml
similarity index 100%
rename from core/modules/menu_ui/config/menu_ui.settings.yml
rename to core/modules/menu_ui/config/install/menu_ui.settings.yml