diff --git a/core/includes/config.inc b/core/includes/config.inc index c143dd4..5b1fe21 100644 --- a/core/includes/config.inc +++ b/core/includes/config.inc @@ -12,22 +12,24 @@ use Drupal\Core\Config\StorageInterface; */ /** - * Installs the default configuration of a given module. + * Installs the default configuration of a given extension. * - * @param - * The name of the module we are installing. + * @param string $type + * The extension type; e.g., 'module' or 'theme'. + * @param string $name + * The name of the module or theme to install default configuration for. * * @todo Make this acknowledge other storage engines rather than having * SQL be hardcoded. */ -function config_install_default_config($module) { - $module_config_dir = drupal_get_path('module', $module) . '/config'; - if (is_dir($module_config_dir)) { - $source_storage = new FileStorage(array('directory' => $module_config_dir)); +function config_install_default_config($type, $name) { + $config_dir = drupal_get_path($type, $name) . '/config'; + if (is_dir($config_dir)) { + $source_storage = new FileStorage(array('directory' => $config_dir)); $target_storage = new DatabaseStorage(); $null_storage = new NullStorage(); - // Upon module installation, only new config objects need to be created. + // Upon installation, only new config objects need to be created. // config_sync_get_changes() would potentially perform a diff of hundreds or // even thousands of config objects that happen to be contained in the // active store. We leverage the NullStorage to avoid that needless diff --git a/core/includes/install.inc b/core/includes/install.inc index 91e10a1..c3c91d8 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -387,7 +387,7 @@ function drupal_install_system() { system_rebuild_module_data(); system_rebuild_theme_data(); - config_install_default_config('system'); + config_install_default_config('module', 'system'); module_invoke('system', 'install'); } diff --git a/core/includes/module.inc b/core/includes/module.inc index 0f0f705..ab45576 100644 --- a/core/includes/module.inc +++ b/core/includes/module.inc @@ -462,7 +462,7 @@ function module_enable($module_list, $enable_dependencies = TRUE) { $version = $versions ? max($versions) : SCHEMA_INSTALLED; // Install default configuration of the module. - config_install_default_config($module); + config_install_default_config('module', $module); // If the module has no current updates, but has some that were // previously removed, set the version to the value of diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 8977faf..011b0b8 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1417,6 +1417,9 @@ function theme_enable($theme_list) { ->condition('type', 'theme') ->condition('name', $key) ->execute(); + + // Install default configuration of the theme. + config_install_default_config('theme', $key); } list_themes(TRUE);