function hook_modules_installed

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

Perform necessary actions after modules are installed.

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

This hook should be implemented in a .module file, not in an .install file.

Parameters

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

See also

module_enable()

hook_modules_enabled()

hook_install()

Related topics

17 functions implement hook_modules_installed()

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.

BlockHooks::modulesInstalled in core/modules/block/src/Hook/BlockHooks.php
Implements hook_modules_installed().
ConfigImportTestHooks::modulesInstalled in core/modules/config/tests/config_import_test/src/Hook/ConfigImportTestHooks.php
Implements hook_modules_installed().
HelpHooks::modulesInstalled in core/modules/help/src/Hook/HelpHooks.php
Implements hook_modules_installed().
JsonapiHooks::modulesInstalled in core/modules/jsonapi/src/Hook/JsonapiHooks.php
Implements hook_modules_installed().
LanguageHooks::modulesInstalled in core/modules/language/src/Hook/LanguageHooks.php
Implements hook_modules_installed().

... See full list

1 invocation of hook_modules_installed()
module_enable in includes/module.inc
Enables or installs a given list of modules.

File

modules/system/system.api.php, line 2674

Code

function hook_modules_installed($modules) {
    if (in_array('lousy_module', $modules)) {
        variable_set('lousy_module_conflicting_variable', FALSE);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.