hook_modules_enabled

7 system.api.php hook_modules_enabled($modules)
8 system.api.php hook_modules_enabled($modules)

Perform necessary actions after modules are enabled.

This function differs from hook_enable() in that it gives all other modules a chance to perform actions when modules are enabled, whereas hook_enable() is only called on the module actually being enabled. See module_enable() for a detailed description of the order in which install and enable hooks are invoked.

Parameters

$modules: An array of the modules that were enabled.

See also

hook_enable()

hook_modules_installed()

module_enable()

Related topics

7 functions implement hook_modules_enabled()

1 invocation of hook_modules_enabled()

File

modules/system/system.api.php, line 2588
Hooks provided by Drupal core and the System module.

Code

function hook_modules_enabled($modules) {
  if (in_array('lousy_module', $modules)) {
    drupal_set_message(t('mymodule is not compatible with lousy_module'), 'error');
    mymodule_disable_functionality();
  }
}

Comments

Does not run during site installation

hook_modules_enabled() does not run during Drupal site installation. In other words, you cannot rely on this hook for any module enabled by an install profile.

This is not true, at least

This is not true, at least for D7.
hook_modules_enabled() runs normally.

Login or register to post comments