diff --git a/src/BehaviorInvoker.php b/src/BehaviorInvoker.php index 26199a5..ab2ae5a 100644 --- a/src/BehaviorInvoker.php +++ b/src/BehaviorInvoker.php @@ -112,7 +112,7 @@ class BehaviorInvoker implements BehaviorInvokerInterface { public function getPossibleEntityTypeKeys() { $entity_type_keys = array(); foreach ($this->rhEntityPluginManager->getDefinitions() as $def) { - $entity_type_keys[] = $def['entity_type']; + $entity_type_keys[] = $def['entityType']; } return $entity_type_keys; } diff --git a/src/FormManglerService.php b/src/FormManglerService.php index 514feb3..0ccc6da 100644 --- a/src/FormManglerService.php +++ b/src/FormManglerService.php @@ -142,7 +142,8 @@ class FormManglerService { } $entity_plugin = $this->rhEntityPluginManager->createInstanceByEntityType( - $entity_type_id); + $is_bundle_or_entity_type ? $entity_type->getBundleOf() + : $entity_type->id()); // If the user doesn't have access, exit. // If the form is about to be attached to an entity, but the bundle isn't diff --git a/src/Plugin/RabbitHoleEntityPluginManager.php b/src/Plugin/RabbitHoleEntityPluginManager.php index a2e4808..707eb90 100644 --- a/src/Plugin/RabbitHoleEntityPluginManager.php +++ b/src/Plugin/RabbitHoleEntityPluginManager.php @@ -71,7 +71,7 @@ class RabbitHoleEntityPluginManager extends DefaultPluginManager { */ public function loadDefinitionsByEntityType($entity_type) { return array_filter($this->getDefinitions(), function($var) use ($entity_type) { - return $var['entity_type'] == $entity_type; + return $var['entityType'] == $entity_type; }); } @@ -83,7 +83,7 @@ class RabbitHoleEntityPluginManager extends DefaultPluginManager { */ public function loadSupportedEntityTypes() { return array_values(array_map(function($var) { - return $var['entity_type']; + return $var['entityType']; }, $this->getDefinitions())); } @@ -94,8 +94,8 @@ class RabbitHoleEntityPluginManager extends DefaultPluginManager { * An array of entity type ID strings. */ public function loadSupportedBundleEntityTypes() { - return array_values(array_map(function($var, $this) { - return $this->etm->getStorage($var['entity_type']) + return array_values(array_map(function($var) { + return $this->etm->getStorage($var['entityType']) ->getEntityType()->getBundleEntityType(); }, $this->getDefinitions())); } @@ -112,7 +112,7 @@ class RabbitHoleEntityPluginManager extends DefaultPluginManager { foreach ($this->getDefinitions() as $key => $def) { $form_id = $this->createInstance($key)->getGlobalConfigFormId(); if (isset($form_id)) { - $result[$form_id] = $def['entity_type']; + $result[$form_id] = $def['entityType']; } } return $result;