You are here

public function EventType::getIdentityTypeEntityFormModes in RNG - Events and Registrations 8

Get the form display modes for creating identities inline.

Return value

array An array keyed as follows: [entity_type][bundle] = form_mode.

Overrides EventTypeInterface::getIdentityTypeEntityFormModes

File

src/Entity/EventType.php, line 220

Class

EventType
Defines the event type entity.

Namespace

Drupal\rng\Entity

Code

public function getIdentityTypeEntityFormModes() {
  $result = [];
  foreach ($this->people_types as $people_type) {
    $required_keys = [
      'entity_type',
      'bundle',
      'entity_form_mode',
    ];

    // Ensure keys exist.
    if (count($required_keys) === count(array_intersect_key(array_flip($required_keys), $people_type))) {
      $entity_type = $people_type['entity_type'];
      $bundle = $people_type['bundle'];
      $result[$entity_type][$bundle] = $people_type['entity_form_mode'];
    }
  }
  return $result;
}