function hook_module_preinstall

Same name in other branches
  1. 9 core/lib/Drupal/Core/Extension/module.api.php \hook_module_preinstall()
  2. 8.9.x core/lib/Drupal/Core/Extension/module.api.php \hook_module_preinstall()
  3. 11.x core/lib/Drupal/Core/Extension/module.api.php \hook_module_preinstall()

Perform necessary actions before a module is installed.

Parameters

string $module: The name of the module about to be installed.

bool $is_syncing: TRUE if the module is being installed as part of a configuration import. In these cases, your hook implementation needs to carefully consider what changes, if any, it should make. For example, it should not make any changes to configuration objects or configuration entities. Those changes should be made earlier and exported so during import there's no need to do them again.

Related topics

4 functions implement hook_module_preinstall()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

demo_umami_content_module_preinstall in core/profiles/demo_umami/modules/demo_umami_content/demo_umami_content.install
Implements hook_module_preinstall().
language_test_module_preinstall in core/modules/language/tests/language_test/language_test.module
Implements hook_module_preinstall().
system_test_module_preinstall in core/modules/system/tests/modules/system_test/system_test.module
Implements hook_module_preinstall().
workspaces_module_preinstall in core/modules/workspaces/workspaces.install
Implements hook_module_preinstall().
1 invocation of hook_module_preinstall()
ModuleInstaller::install in core/lib/Drupal/Core/Extension/ModuleInstaller.php

File

core/lib/Drupal/Core/Extension/module.api.php, line 172

Code

function hook_module_preinstall($module, bool $is_syncing) {
    my_module_cache_clear();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.