Enables or installs a given list of modules.
Definitions:
- "Enabling" is the process of activating a module for use by Drupal.
- "Disabling" is the process of deactivating a module.
- "Installing" is the process of enabling it for the first time or after it
has been uninstalled.
- "Uninstalling" is the process of removing all traces of a module.
Order of events:
- Gather and add module dependencies to $module_list (if applicable).
- For each module that is being enabled:
- Install module schema and update system registries and caches.
- If the module is being enabled for the first time or had been
uninstalled, invoke hook_install() and add it to the list of installed
modules.
- Invoke hook_enable().
- Invoke hook_modules_installed().
- Invoke hook_modules_enabled().
Parameters
$module_list:
An array of module names.
$enable_dependencies:
If TRUE, dependencies will automatically be added and enabled in the
correct order. This incurs a significant performance cost, so use FALSE
if you know $module_list is already complete and in the correct order.
Return value
FALSE if one or more dependencies are missing, TRUE otherwise.
See also
hook_install()
hook_enable()
hook_modules_installed()
hook_modules_enabled()
File
- drupal/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php, line 301
- Contains Drupal\Core\Extension\ModuleHandlerInterface.
Class
- ModuleHandlerInterface
- Interface for classes that manage a set of enabled modules.
Namespace
Drupal\Core\Extension
Code
public function enable($module_list, $enable_dependencies = TRUE);