You are here

public function PhpSelection::countReferenceableEntities in Zircon Profile 8.0

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()

Counts entities that are referenceable.

Return value

int The number of referenceable entities.

Overrides DefaultSelection::countReferenceableEntities

File

core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/PhpSelection.php, line 73
Contains \Drupal\Core\Entity\Plugin\EntityReferenceSelection\PhpSelection.

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;
}