You are here

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

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

Get identity types which can be created for this event.

The types returned are guaranteed to exist in the system. Invalid configuration such as no-longer existing bundles or entity types are filtered out.

Return value

array Array of bundles keyed by entity type.

Overrides EventMetaInterface::getCreatableIdentityTypes

1 call to EventMeta::getCreatableIdentityTypes()
EventMeta::canRegisterProxyIdentities in src/EventMeta.php
Determine if the current user has proxy register access.

File

src/EventMeta.php, line 594

Class

EventMeta
Meta event wrapper for RNG.

Namespace

Drupal\rng

Code

public function getCreatableIdentityTypes() {
  $event_type = $this
    ->getEventType();
  $result = [];
  $identity_types_available = $this->rngConfiguration
    ->getIdentityTypes();
  foreach ($identity_types_available as $entity_type_id) {
    $bundles = $this->bundleInfo
      ->getBundleInfo($entity_type_id);
    foreach ($bundles as $bundle => $info) {
      if ($event_type
        ->canIdentityTypeCreate($entity_type_id, $bundle)) {
        $result[$entity_type_id][] = $bundle;
      }
    }
  }
  return $result;
}