function 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 87

Class

ForumUninstallValidator
Prevents forum module from being uninstalled under certain conditions.

Namespace

Drupal\forum

Code

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.