You are here

function hook_modules_installed in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 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 \Drupal\Core\Extension\ModuleHandler::install() for a detailed description of the order in which install 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

\Drupal\Core\Extension\ModuleHandler::install()

hook_install()

Related topics

5 functions implement hook_modules_installed()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

language_modules_installed in core/modules/language/language.module
Implements hook_modules_installed().
locale_modules_installed in core/modules/locale/locale.module
Implements hook_modules_installed().
module_test_modules_installed in core/modules/system/tests/modules/module_test/module_test.module
Implements hook_modules_installed().
node_modules_installed in core/modules/node/node.module
Implements hook_modules_installed().
system_test_modules_installed in core/modules/system/tests/modules/system_test/system_test.module
Implements hook_modules_installed().
2 invocations of hook_modules_installed()
ModuleImplementsAlterTest::testModuleImplementsAlter in core/modules/system/src/Tests/Module/ModuleImplementsAlterTest.php
Tests hook_module_implements_alter() adding an implementation.
ModuleInstaller::install in core/lib/Drupal/Core/Extension/ModuleInstaller.php
Installs a given list of modules.

File

core/lib/Drupal/Core/Extension/module.api.php, line 189
Hooks related to module and update systems.

Code

function hook_modules_installed($modules) {
  if (in_array('lousy_module', $modules)) {
    \Drupal::state()
      ->set('mymodule.lousy_module_compatibility', TRUE);
  }
}