function ModuleRequiredByThemesUninstallValidator::validate
Same name in this branch
- 9 core/lib/Drupal/Core/ProxyClass/Extension/ModuleRequiredByThemesUninstallValidator.php \Drupal\Core\ProxyClass\Extension\ModuleRequiredByThemesUninstallValidator::validate()
Same name in other branches
- 8.9.x core/lib/Drupal/Core/ProxyClass/Extension/ModuleRequiredByThemesUninstallValidator.php \Drupal\Core\ProxyClass\Extension\ModuleRequiredByThemesUninstallValidator::validate()
- 8.9.x core/lib/Drupal/Core/Extension/ModuleRequiredByThemesUninstallValidator.php \Drupal\Core\Extension\ModuleRequiredByThemesUninstallValidator::validate()
- 10 core/lib/Drupal/Core/ProxyClass/Extension/ModuleRequiredByThemesUninstallValidator.php \Drupal\Core\ProxyClass\Extension\ModuleRequiredByThemesUninstallValidator::validate()
- 10 core/lib/Drupal/Core/Extension/ModuleRequiredByThemesUninstallValidator.php \Drupal\Core\Extension\ModuleRequiredByThemesUninstallValidator::validate()
- 11.x core/lib/Drupal/Core/ProxyClass/Extension/ModuleRequiredByThemesUninstallValidator.php \Drupal\Core\ProxyClass\Extension\ModuleRequiredByThemesUninstallValidator::validate()
- 11.x core/lib/Drupal/Core/Extension/ModuleRequiredByThemesUninstallValidator.php \Drupal\Core\Extension\ModuleRequiredByThemesUninstallValidator::validate()
Overrides ModuleUninstallValidatorInterface::validate
File
-
core/
lib/ Drupal/ Core/ Extension/ ModuleRequiredByThemesUninstallValidator.php, line 49
Class
- ModuleRequiredByThemesUninstallValidator
- Ensures modules cannot be uninstalled if enabled themes depend on them.
Namespace
Drupal\Core\ExtensionCode
public function validate($module) {
$reasons = [];
$themes_depending_on_module = $this->getThemesDependingOnModule($module);
if (!empty($themes_depending_on_module)) {
$module_name = $this->moduleExtensionList
->get($module)->info['name'];
$theme_names = implode(', ', $themes_depending_on_module);
$reasons[] = $this->formatPlural(count($themes_depending_on_module), 'Required by the theme: @theme_names', 'Required by the themes: @theme_names', [
'@module_name' => $module_name,
'@theme_names' => $theme_names,
]);
}
return $reasons;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.