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

hook_install()

hook_schema()

hook_modules_uninstalled()

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');
}
doc_Drupal
2016-10-29 09:18:34
Comments
Leave a Comment

Please login to continue.