You are here

public function EventMeta::countProxyIdentities in RNG - Events and Registrations 3.x

Same name and namespace in other branches
  1. 8.2 src/EventMeta.php \Drupal\rng\EventMeta::countProxyIdentities()
  2. 8 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

int Number of identities.

Overrides EventMetaInterface::countProxyIdentities

File

src/EventMeta.php, line 519

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;
}