function hook_uninstall
hook_uninstall()
Remove any information that the module sets.
The information that the module should remove includes:
- state that the module has set using \Drupal::state()
- modifications to existing tables
The module should not remove its entry from the module configuration. Database tables defined by hook_schema() will be removed automatically.
The uninstall hook must be implemented in the module's .install file. It will fire when the module gets uninstalled but before the module's database tables are removed, allowing your module to query its own tables during this routine.
See also
Related topics
- Hooks
- Define functions that alter the behavior of Drupal core.
File
- core/lib/Drupal/Core/Extension/module.api.php, line 288
- Hooks related to module and update systems.
Code
function hook_uninstall() { // Remove the styles directory and generated images. file_unmanaged_delete_recursive(file_default_scheme() . '://styles'); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Extension!module.api.php/function/hook_uninstall/8.1.x