function ForumUninstallValidator::hasForumNodes
Same name in other branches
- 9 core/modules/forum/src/ForumUninstallValidator.php \Drupal\forum\ForumUninstallValidator::hasForumNodes()
- 10 core/modules/forum/src/ForumUninstallValidator.php \Drupal\forum\ForumUninstallValidator::hasForumNodes()
- 11.x core/modules/forum/src/ForumUninstallValidator.php \Drupal\forum\ForumUninstallValidator::hasForumNodes()
Determines if there are any forum nodes or not.
Return value
bool TRUE if there are forum nodes, FALSE otherwise.
1 call to ForumUninstallValidator::hasForumNodes()
- ForumUninstallValidator::validate in core/
modules/ forum/ src/ ForumUninstallValidator.php - Determines the reasons a module can not be uninstalled.
File
-
core/
modules/ forum/ src/ ForumUninstallValidator.php, line 85
Class
- ForumUninstallValidator
- Prevents forum module from being uninstalled whilst any forum nodes exist or there are any terms in the forum vocabulary.
Namespace
Drupal\forumCode
protected function hasForumNodes() {
$nodes = $this->entityTypeManager
->getStorage('node')
->getQuery()
->condition('type', 'forum')
->accessCheck(FALSE)
->range(0, 1)
->execute();
return !empty($nodes);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.