You are here

protected function WebformNodeReferencesListController::getTotal in Webform 8.5

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

Get the total number of references.

Return value

int The total number of references.

1 call to WebformNodeReferencesListController::getTotal()
WebformNodeReferencesListController::buildInfo in modules/webform_node/src/Controller/WebformNodeReferencesListController.php
Build information summary.

File

modules/webform_node/src/Controller/WebformNodeReferencesListController.php, line 484

Class

WebformNodeReferencesListController
Defines a controller for webform node references.

Namespace

Drupal\webform_node\Controller

Code

protected function getTotal() {
  $query = $this
    ->getStorage()
    ->getQuery()
    ->sort($this->entityType
    ->getKey('id'));

  // Add field names.
  $or = $query
    ->orConditionGroup();
  foreach ($this->fieldNames as $field_name) {
    $or
      ->condition($field_name . '.target_id', $this->webform
      ->id());
  }
  $query
    ->condition($or);
  return count($query
    ->execute());
}