You are here

public function PhpSelection::countReferenceableEntities in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/PhpSelection.php \Drupal\Core\Entity\Plugin\EntityReferenceSelection\PhpSelection::countReferenceableEntities()
  2. 9 core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/PhpSelection.php \Drupal\Core\Entity\Plugin\EntityReferenceSelection\PhpSelection::countReferenceableEntities()

File

core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/PhpSelection.php, line 67

Class

PhpSelection
Defines an alternative to the default Entity Reference Selection plugin.

Namespace

Drupal\Core\Entity\Plugin\EntityReferenceSelection

Code

public function countReferenceableEntities($match = NULL, $match_operator = 'CONTAINS') {
  $count = 0;
  foreach ($this
    ->getReferenceableEntities($match, $match_operator) as &$items) {
    $count += count($items);
  }
  return $count;
}