function BookUninstallValidator::hasBookNodes
Same name in other branches
- 9 core/modules/book/src/BookUninstallValidator.php \Drupal\book\BookUninstallValidator::hasBookNodes()
- 8.9.x core/modules/book/src/BookUninstallValidator.php \Drupal\book\BookUninstallValidator::hasBookNodes()
- 11.x core/modules/book/src/BookUninstallValidator.php \Drupal\book\BookUninstallValidator::hasBookNodes()
Determines if there is any book nodes or not.
Return value
bool TRUE if there are book nodes, FALSE otherwise.
1 call to BookUninstallValidator::hasBookNodes()
- BookUninstallValidator::validate in core/
modules/ book/ src/ BookUninstallValidator.php - Determines the reasons a module can not be uninstalled.
File
-
core/
modules/ book/ src/ BookUninstallValidator.php, line 86
Class
- BookUninstallValidator
- Prevents book module from being uninstalled under certain conditions.
Namespace
Drupal\bookCode
protected function hasBookNodes() {
$nodes = $this->entityTypeManager
->getStorage('node')
->getQuery()
->condition('type', 'book')
->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.