Skip to content
This repository has been archived by the owner on Jan 5, 2018. It is now read-only.

Issue #2912628: Fix entity browser edit form when edit form class is not defined #158

Open
wants to merge 1 commit into
base: 8.x-1.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/Controllers/EntityBrowserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down