You are here

public function RngEventType::getIdentityTypeEntityFormModes in RNG - Events and Registrations 8.2

Same name and namespace in other branches
  1. 3.x src/Entity/RngEventType.php \Drupal\rng\Entity\RngEventType::getIdentityTypeEntityFormModes()

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/RngEventType.php, line 275

Class

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