public function PhpSelection::countReferenceableEntities in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/PhpSelection.php \Drupal\Core\Entity\Plugin\EntityReferenceSelection\PhpSelection::countReferenceableEntities()
Counts entities that are referenceable.
Parameters
string $match: (optional) Text to match the label against. Defaults to NULL.
string $match_operator: (optional) Operator to be used for string matching. Defaults to "CONTAINS".
Return value
int The number of referenceable entities.
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\EntityReferenceSelectionCode
public function countReferenceableEntities($match = NULL, $match_operator = 'CONTAINS') {
$count = 0;
foreach ($this
->getReferenceableEntities($match, $match_operator) as &$items) {
$count += count($items);
}
return $count;
}