function PhpSelection::countReferenceableEntities

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/PhpSelection.php \Drupal\Core\Entity\Plugin\EntityReferenceSelection\PhpSelection::countReferenceableEntities()
  2. 10 core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/PhpSelection.php \Drupal\Core\Entity\Plugin\EntityReferenceSelection\PhpSelection::countReferenceableEntities()
  3. 11.x core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/PhpSelection.php \Drupal\Core\Entity\Plugin\EntityReferenceSelection\PhpSelection::countReferenceableEntities()

Overrides DefaultSelection::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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.