public function BootstrapLayoutsUninstallValidator::validate in Bootstrap Layouts 8.4
Same name in this branch
- 8.4 src/BootstrapLayoutsUninstallValidator.php \Drupal\bootstrap_layouts\BootstrapLayoutsUninstallValidator::validate()
- 8.4 src/ProxyClass/BootstrapLayoutsUninstallValidator.php \Drupal\bootstrap_layouts\ProxyClass\BootstrapLayoutsUninstallValidator::validate()
Same name and namespace in other branches
- 8.5 src/BootstrapLayoutsUninstallValidator.php \Drupal\bootstrap_layouts\BootstrapLayoutsUninstallValidator::validate()
Determines the reasons a module can not be uninstalled.
Parameters
string $module: A module name.
Return value
string[] An array of reasons the module can not be uninstalled, empty if it can. Each reason should not end with any punctuation since multiple reasons can be displayed together.
Overrides ModuleUninstallValidatorInterface::validate
See also
template_preprocess_system_modules_uninstall()
File
- src/
BootstrapLayoutsUninstallValidator.php, line 35
Class
- BootstrapLayoutsUninstallValidator
- Class BootstrapLayoutsUninstallValidator
Namespace
Drupal\bootstrap_layoutsCode
public function validate($module) {
$reasons = [];
if ($module === 'bootstrap_layouts') {
$layouts = [];
foreach ($this->manager
->getHandlers() as $handler) {
foreach ($handler
->loadInstances() as $storage_id => $layout) {
if ($layout
->isBootstrapLayout()) {
$layouts[$layout
->getId()][] = $handler
->getPluginId() . ':' . $storage_id;
}
}
}
ksort($layouts);
foreach ($layouts as $layout_id => $storage_ids) {
sort($storage_ids, SORT_NATURAL);
$reasons[] = $this
->t('Using layout: @layout_id (@storage_ids)', [
'@layout_id' => $layout_id,
'@storage_ids' => implode(', ', $storage_ids),
]);
}
}
return $reasons;
}