Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Extension/module.api.php \hook_module_preuninstall()
  2. 9 core/lib/Drupal/Core/Extension/module.api.php \hook_module_preuninstall()

Perform necessary actions before a module is uninstalled.

Parameters

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

bool $is_syncing: TRUE if the module is being uninstalled as part of a configuration import. In these cases, your hook implementation needs to carefully consider what 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

2 functions implement hook_module_preuninstall()

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

locale_module_preuninstall in core/modules/locale/locale.module
Implements hook_module_preuninstall().
system_test_module_preuninstall in core/modules/system/tests/modules/system_test/system_test.module
Implements hook_module_preuninstall().

File

core/lib/Drupal/Core/Extension/module.api.php, line 269
Hooks related to module and update systems.

Code

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