BookUninstallValidator::hasBookNodes

protected BookUninstallValidator::hasBookNodes()

Determines if there is any book nodes or not.

Return value

bool TRUE if there are book nodes, FALSE otherwise.

File

core/modules/book/src/BookUninstallValidator.php, line 84

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);
}
doc_Drupal
2016-10-29 08:48:35
Comments
Leave a Comment

Please login to continue.