Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / entity_browser / src / Controllers / EntityBrowserController.php
index aebb4be8060a5e9c0441aed6b862f3d9bb270239..c3788809defe424a1254a557308caf66d941d5ba 100644 (file)
@@ -29,8 +29,16 @@ class EntityBrowserController extends ControllerBase {
    *   containing the edit form.
    */
   public function entityBrowserEdit(EntityInterface $entity, Request $request) {
+
+    // Use edit form class if it exists, otherwise use default form class.
+    $operation = 'default';
+    $entity_type = $entity->getEntityType();
+    if ($entity_type->getFormClass('edit')) {
+      $operation = 'edit';
+    }
+
     // Build the entity edit form.
-    $form_object = $this->entityTypeManager()->getFormObject($entity->getEntityTypeId(), 'edit');
+    $form_object = $this->entityTypeManager()->getFormObject($entity->getEntityTypeId(), $operation);
     $form_object->setEntity($entity);
     $form_state = (new FormState())
       ->setFormObject($form_object)