You are here

protected function MerciBundleUninstallValidator::hasContent in MERCI (Manage Equipment Reservations, Checkout and Inventory) 8.2

Determines if there are any forum nodes or not.

Return value

bool TRUE if there are forum nodes, FALSE otherwise.

File

src/MerciBundleUninstallValidator.php, line 80
Contains \Drupal\merci\MerciBundleUninstallValidator.

Class

MerciBundleUninstallValidator
Prevents forum module from being uninstalled whilst any forum nodes exist or there are any terms in the forum vocabulary.

Namespace

Drupal\merci

Code

protected function hasContent($bundle, $entity_type = 'node') {
  $nodes = $this->queryFactory
    ->get($entity_type)
    ->condition('type', $bundle)
    ->accessCheck(FALSE)
    ->range(0, 1)
    ->execute();
  return !empty($nodes);
}