public function CivicrmEntityForm::setFormDisplay in CiviCRM Entity 8.3
If this CiviCRM Entity type supports bundles, we hijack the loaded entity form display to be one for the root entity, not the bundle.
Overrides ContentEntityForm::setFormDisplay
File
- src/
Form/ CivicrmEntityForm.php, line 60
Class
Namespace
Drupal\civicrm_entity\FormCode
public function setFormDisplay(EntityFormDisplayInterface $form_display, FormStateInterface $form_state) {
$entity_type = $this->entity
->getEntityType();
if ($entity_type
->hasKey('bundle')) {
$entity_display_repository = \Drupal::service('entity_display.repository');
assert($entity_display_repository instanceof EntityDisplayRepositoryInterface);
$form_display = $entity_display_repository
->getFormDisplay($entity_type
->id(), $entity_type
->id());
}
return parent::setFormDisplay($form_display, $form_state);
}