You are here

public function ModuleInstaller::validateUninstall in Drupal 8

Same name in this branch
  1. 8 core/lib/Drupal/Core/Extension/ModuleInstaller.php \Drupal\Core\Extension\ModuleInstaller::validateUninstall()
  2. 8 core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php \Drupal\Core\ProxyClass\Extension\ModuleInstaller::validateUninstall()
Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Extension/ModuleInstaller.php \Drupal\Core\Extension\ModuleInstaller::validateUninstall()
  2. 10 core/lib/Drupal/Core/Extension/ModuleInstaller.php \Drupal\Core\Extension\ModuleInstaller::validateUninstall()

Determines whether a list of modules can be uninstalled.

Parameters

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

Return value

string[] An array of reasons the module can not be uninstalled, empty if it can.

Overrides ModuleInstallerInterface::validateUninstall

1 call to ModuleInstaller::validateUninstall()
ModuleInstaller::uninstall in core/lib/Drupal/Core/Extension/ModuleInstaller.php
Uninstalls a given list of modules.

File

core/lib/Drupal/Core/Extension/ModuleInstaller.php, line 588

Class

ModuleInstaller
Default implementation of the module installer.

Namespace

Drupal\Core\Extension

Code

public function validateUninstall(array $module_list) {
  $reasons = [];
  foreach ($module_list as $module) {
    foreach ($this->uninstallValidators as $validator) {
      $validation_reasons = $validator
        ->validate($module);
      if (!empty($validation_reasons)) {
        if (!isset($reasons[$module])) {
          $reasons[$module] = [];
        }
        $reasons[$module] = array_merge($reasons[$module], $validation_reasons);
      }
    }
  }
  return $reasons;
}