You are here

public function EventMeta::countProxyIdentities in RNG - Events and Registrations 8

Same name and namespace in other branches
  1. 8.2 src/EventMeta.php \Drupal\rng\EventMeta::countProxyIdentities()
  2. 3.x src/EventMeta.php \Drupal\rng\EventMeta::countProxyIdentities()

Count number of identities the current user has proxy register access.

This number includes the current user. It also only considers existing identities, it does not include the ability to 'create' new identities.

Return value

integer Number of identities.

Overrides EventMetaInterface::countProxyIdentities

File

src/EventMeta.php, line 469

Class

EventMeta
Meta event wrapper for RNG.

Namespace

Drupal\rng

Code

public function countProxyIdentities() {
  $total = 0;
  foreach ($this
    ->getIdentityTypes() as $entity_type_id => $bundles) {
    if ($this
      ->entityTypeHasBundles($entity_type_id)) {
      $total += $this
        ->countRngReferenceableEntities($entity_type_id, $bundles);
    }
    elseif (!empty($bundles)) {
      $total += $this
        ->countRngReferenceableEntities($entity_type_id);
    }
  }
  return $total;
}