protected function EventMeta::countRngReferenceableEntities in RNG - Events and Registrations 8
Same name and namespace in other branches
- 8.2 src/EventMeta.php \Drupal\rng\EventMeta::countRngReferenceableEntities()
- 3.x src/EventMeta.php \Drupal\rng\EventMeta::countRngReferenceableEntities()
Count referencable entities using a rng_register entity selection plugin.
Parameters
string $entity_type_id: An identity entity type ID.
array $bundles: (optional) An array of bundles.
Return value
integer The number of referencable entities.
2 calls to EventMeta::countRngReferenceableEntities()
- EventMeta::canRegisterProxyIdentities in src/
EventMeta.php - Determine if the current user has proxy register access.
- EventMeta::countProxyIdentities in src/
EventMeta.php - Count number of identities the current user has proxy register access.
File
- src/
EventMeta.php, line 495
Class
- EventMeta
- Meta event wrapper for RNG.
Namespace
Drupal\rngCode
protected function countRngReferenceableEntities($entity_type_id, $bundles = []) {
$selection_groups = $this->selectionPluginManager
->getSelectionGroups($entity_type_id);
if (isset($selection_groups['rng_register'])) {
$options = [
'target_type' => $entity_type_id,
'handler' => 'rng_register',
'handler_settings' => [
'event_entity_type' => $this
->getEvent()
->getEntityTypeId(),
'event_entity_id' => $this
->getEvent()
->id(),
],
];
if (!empty($bundles)) {
$options['handler_settings']['target_bundles'] = $bundles;
}
return $this->selectionPluginManager
->getInstance($options)
->countReferenceableEntities();
}
return 0;
}