You are here

public function ModuleInstaller::install in Service Container 7.2

Same name and namespace in other branches
  1. 7 src/Extension/ModuleInstaller.php \Drupal\service_container\Extension\ModuleInstaller::install()

Installs a given list of modules.

Order of events:

  • Gather and add module dependencies to $module_list (if applicable).
  • For each module that is being installed:
    • Invoke hook_module_preinstall().
    • Install module schema and update system registries and caches.
    • Invoke hook_install() and add it to the list of installed modules.
  • Invoke hook_modules_installed().

Parameters

string[] $module_list: An array of module names.

bool $enable_dependencies: (optional) If TRUE, dependencies will automatically be installed in the correct order. This incurs a significant performance cost, so use FALSE if you know $module_list is already complete.

Return value

bool TRUE if the modules were successfully installed.

Throws

\Drupal\Core\Extension\MissingDependencyException Thrown when a requested module, or a dependency of one, can not be found.

Overrides ModuleInstallerInterface::install

See also

hook_module_preinstall()

hook_install()

hook_modules_installed()

File

src/Extension/ModuleInstaller.php, line 41
Contains \Drupal\service_container\Extension\ModuleInstaller.

Class

ModuleInstaller
Provides a module installer compatible with D7.

Namespace

Drupal\service_container\Extension

Code

public function install(array $module_list, $enable_dependencies = TRUE) {
  $this->drupal7
    ->module_enable($module_list, $enable_dependencies);
}