You are here

protected function WebformNodeUninstallValidator::hasWebformNodes in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_node/src/WebformNodeUninstallValidator.php \Drupal\webform_node\WebformNodeUninstallValidator::hasWebformNodes()

Determines if there is any webform nodes or not.

Return value

bool TRUE if there are webform nodes, FALSE otherwise.

1 call to WebformNodeUninstallValidator::hasWebformNodes()
WebformNodeUninstallValidator::validate in modules/webform_node/src/WebformNodeUninstallValidator.php
Determines the reasons a module can not be uninstalled.

File

modules/webform_node/src/WebformNodeUninstallValidator.php, line 58

Class

WebformNodeUninstallValidator
Prevents webform_node module from being uninstalled whilst any webform nodes exist.

Namespace

Drupal\webform_node

Code

protected function hasWebformNodes() {
  $nodes = $this->entityTypeManager
    ->getStorage('node')
    ->getQuery()
    ->condition('type', 'webform')
    ->accessCheck(FALSE)
    ->range(0, 1)
    ->execute();
  return !empty($nodes);
}