You are here

protected function BookUninstallValidator::hasBookNodes in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 89
Contains \Drupal\book\BookUninstallValidator.

Class

BookUninstallValidator
Prevents book module from being uninstalled whilst any book nodes exist or there are any book outline stored.

Namespace

Drupal\book

Code

protected function hasBookNodes() {
  $nodes = $this->entityQuery
    ->condition('type', 'book')
    ->accessCheck(FALSE)
    ->range(0, 1)
    ->execute();
  return !empty($nodes);
}