function ForumUninstallValidator::validate
Same name in this branch
- 10 core/modules/forum/src/ProxyClass/ForumUninstallValidator.php \Drupal\forum\ProxyClass\ForumUninstallValidator::validate()
Same name in other branches
- 9 core/modules/forum/src/ProxyClass/ForumUninstallValidator.php \Drupal\forum\ProxyClass\ForumUninstallValidator::validate()
- 9 core/modules/forum/src/ForumUninstallValidator.php \Drupal\forum\ForumUninstallValidator::validate()
- 8.9.x core/modules/forum/src/ProxyClass/ForumUninstallValidator.php \Drupal\forum\ProxyClass\ForumUninstallValidator::validate()
- 8.9.x core/modules/forum/src/ForumUninstallValidator.php \Drupal\forum\ForumUninstallValidator::validate()
- 11.x core/modules/forum/src/ProxyClass/ForumUninstallValidator.php \Drupal\forum\ProxyClass\ForumUninstallValidator::validate()
- 11.x core/modules/forum/src/ForumUninstallValidator.php \Drupal\forum\ForumUninstallValidator::validate()
Overrides ModuleUninstallValidatorInterface::validate
File
-
core/
modules/ forum/ src/ ForumUninstallValidator.php, line 55
Class
- ForumUninstallValidator
- Prevents forum module from being uninstalled under certain conditions.
Namespace
Drupal\forumCode
public function validate($module) {
$reasons = [];
if ($module == 'forum') {
if ($this->hasForumNodes()) {
$reasons[] = $this->t('To uninstall Forum, first delete all <em>Forum</em> content');
}
$vocabulary = $this->getForumVocabulary();
if (!empty($vocabulary) && $this->hasTermsForVocabulary($vocabulary)) {
if ($vocabulary->access('view')) {
$reasons[] = $this->t('To uninstall Forum, first delete all <a href=":url">%vocabulary</a> terms', [
'%vocabulary' => $vocabulary->label(),
':url' => $vocabulary->toUrl('overview-form')
->toString(),
]);
}
else {
$reasons[] = $this->t('To uninstall Forum, first delete all %vocabulary terms', [
'%vocabulary' => $vocabulary->label(),
]);
}
}
}
return $reasons;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.