inline_entity_form_dialog
Opens referenced entity forms in a Drupal modal dialog instead of embedding them inline. A stable, zero-dependency alternative to Inline Entity Form that avoids nested form state entirely.
Inline Entity Form Dialog provides an entity_reference field widget that lets editors add, edit, and reorder referenced entities without ever nesting one Drupal form inside another.
The problem with Inline Entity Form
Drupal's Form API was not designed for nested forms. IEF embeds a complete entity form — with its own form state, validation pipeline, submit handlers, and AJAX callbacks — inside an outer form being processed by the same pipeline. This causes a well-known class of problems: form state value bleed, cascading AJAX failures when the outer form rebuilds, submit handler ordering conflicts, and repeated breakage on minor core updates (IEF's core file alone exceeds 1,140 lines, most of which are workarounds for these issues).
How this module works
The parent form stores only a JSON array of entity IDs in a hidden input. "Add" and "Edit" buttons open the referenced entity's native form inside a ui-dialog modal — a completely separate page request with its own independent form state. After the dialog saves:
- A custom AJAX command (UpdateEntityReferenceCommand) is returned by the server.
- The JS handler appends the pre-rendered item row to the widget table and updates the hidden input.
- The dialog closes. The parent form is never rebuilt.
On parent form submission, massageFormValues() reads the hidden input and returns the standard ['target_id' => $id] array to Drupal's Field API — exactly as any other entity reference widget does.
Features
- Add new referenced entities via a dialog (configurable form mode)
- Edit existing referenced entities via a dialog
- Remove references (client-side, entity not deleted)
- Drag-and-drop reorder with Drupal.tableDrag
- Autocomplete field to reference existing entities
- Configurable dialog width and form mode per field instance
- Cardinality enforcement (Add button hidden at limit)
- Zero contrib dependencies
- Drupal 11 — uses #[Hook] attribute system throughout
No dependency on Inline Entity Form
This module is a standalone replacement. It does not require, extend, or interact with the inline_entity_form module.
Similar projects
Inline Entity Form:
Drupal's Form API was not designed for nested forms. IEF embeds a complete entity form — with its own form state, validation pipeline, submit handlers, and AJAX callbacks — inside an outer form being processed by the same pipeline. This causes a well-known class of problems: form state value bleed, cascading AJAX failures when the outer form rebuilds, submit handler ordering conflicts, and repeated breakage on minor core updates (IEF's core file alone exceeds 1,140 lines, most of which are workarounds for these issues).