function TermSelection::countReferenceableEntities

Same name and namespace in other branches
  1. 9 core/modules/taxonomy/src/Plugin/EntityReferenceSelection/TermSelection.php \Drupal\taxonomy\Plugin\EntityReferenceSelection\TermSelection::countReferenceableEntities()
  2. 8.9.x core/modules/taxonomy/src/Plugin/EntityReferenceSelection/TermSelection.php \Drupal\taxonomy\Plugin\EntityReferenceSelection\TermSelection::countReferenceableEntities()
  3. 11.x core/modules/taxonomy/src/Plugin/EntityReferenceSelection/TermSelection.php \Drupal\taxonomy\Plugin\EntityReferenceSelection\TermSelection::countReferenceableEntities()

Overrides DefaultSelection::countReferenceableEntities

File

core/modules/taxonomy/src/Plugin/EntityReferenceSelection/TermSelection.php, line 86

Class

TermSelection
Provides specific access control for the taxonomy_term entity type.

Namespace

Drupal\taxonomy\Plugin\EntityReferenceSelection

Code

public function countReferenceableEntities($match = NULL, $match_operator = 'CONTAINS') {
  if ($match) {
    return parent::countReferenceableEntities($match, $match_operator);
  }
  $total = 0;
  $referenceable_entities = $this->getReferenceableEntities($match, $match_operator, 0);
  foreach ($referenceable_entities as $entities) {
    $total += count($entities);
  }
  return $total;
}

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