public function GroupContentUninstallValidator::validate in Group 2.0.x
Same name in this branch
- 2.0.x src/UninstallValidator/GroupContentUninstallValidator.php \Drupal\group\UninstallValidator\GroupContentUninstallValidator::validate()
- 2.0.x src/ProxyClass/UninstallValidator/GroupContentUninstallValidator.php \Drupal\group\ProxyClass\UninstallValidator\GroupContentUninstallValidator::validate()
Same name and namespace in other branches
- 8 src/UninstallValidator/GroupContentUninstallValidator.php \Drupal\group\UninstallValidator\GroupContentUninstallValidator::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/
UninstallValidator/ GroupContentUninstallValidator.php, line 49
Class
Namespace
Drupal\group\UninstallValidatorCode
public function validate($module) {
$reasons = $plugin_names = [];
/** @var \Drupal\group\Plugin\Group\Relation\GroupRelationInterface $plugin */
foreach ($this->pluginManager
->getAll() as $plugin_id => $plugin) {
if ($plugin
->getProvider() == $module && $this
->hasGroupContent($plugin_id)) {
$plugin_names[] = $plugin
->getLabel();
}
}
if (!empty($plugin_names)) {
$reasons[] = $this
->t('The following group content plugins still have content for them: %plugins.', [
'%plugins' => implode(', ', $plugin_names),
]);
}
return $reasons;
}