diff --git a/core/lib/Drupal/Core/Extension/module.api.php b/core/lib/Drupal/Core/Extension/module.api.php index e30fd87..877cca9 100644 --- a/core/lib/Drupal/Core/Extension/module.api.php +++ b/core/lib/Drupal/Core/Extension/module.api.php @@ -201,6 +201,12 @@ function hook_modules_installed($modules) { * See the @link https://www.drupal.org/node/146843 Schema API documentation * @endlink for details on hook_schema and how database tables are defined. * + * If the module edits the current site configuration or creates a new + * config/content entity make sure that config installer should not be in + * syncing state. See shortcut_install() to see how to edit current site + * configuration or see forum_install() to see how to create content during + * hook install. + * * Note that since this function is called from a full bootstrap, all functions * (including those in modules enabled by the current page request) are * available when this hook is called. Use cases could be displaying a user @@ -219,6 +225,10 @@ function hook_install() { $directory = file_default_scheme() . '://styles'; $mode = isset($GLOBALS['install_state']['mode']) ? $GLOBALS['install_state']['mode'] : NULL; file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS, $mode); + + if (!\Drupal::service('config.installer')->isSyncing() && \Drupal::moduleHandler()->moduleExists('some_module')) { + \Drupal::configFactory()->getEditable('some_module.settings')->set('third_party_settings.my_module.some_key', TRUE)->save(TRUE); + } } /**