function hook_modules_uninstalled
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Extension/module.api.php \hook_modules_uninstalled()
- 8.9.x core/lib/Drupal/Core/Extension/module.api.php \hook_modules_uninstalled()
- 10 core/lib/Drupal/Core/Extension/module.api.php \hook_modules_uninstalled()
- 11.x core/lib/Drupal/Core/Extension/module.api.php \hook_modules_uninstalled()
Perform necessary actions after modules are uninstalled.
This function differs from hook_uninstall() in that it gives all other modules a chance to perform actions when a module is uninstalled, whereas hook_uninstall() is only called on the module actually being uninstalled.
It is recommended that you implement this hook if your module stores data that may have been set by other modules.
Parameters
$modules: An array of the modules that were uninstalled.
See also
Related topics
14 functions implement hook_modules_uninstalled()
Note: the procedural functions in this list are found by pattern matching, so the list may include some functions that are not actually implementations of this hook.
- block_modules_uninstalled in modules/
block/ block.module - Implements hook_modules_uninstalled().
- HelpHooks::modulesUninstalled in core/
modules/ help/ src/ Hook/ HelpHooks.php - Implements hook_modules_uninstalled().
- LanguageHooks::modulesInstalled in core/
modules/ language/ src/ Hook/ LanguageHooks.php - Implements hook_modules_installed().
- module_test_modules_uninstalled in modules/
simpletest/ tests/ module_test.module - Implements hook_modules_uninstalled().
- NodeHooks1::modulesUninstalled in core/
modules/ node/ src/ Hook/ NodeHooks1.php - Implements hook_modules_uninstalled().
1 invocation of hook_modules_uninstalled()
- drupal_uninstall_modules in includes/
install.inc - Uninstalls a given list of disabled modules.
File
-
modules/
system/ system.api.php, line 2738
Code
function hook_modules_uninstalled($modules) {
foreach ($modules as $module) {
db_delete('mymodule_table')->condition('module', $module)
->execute();
}
mymodule_cache_rebuild();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.