Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

Render Layout Builder edit forms in an iframe, using the admin theme.

Motivation

Layout Builder uses the off-canvas for every section or block form, while also
rendering the entire layout page in the frontend theme. This approach works
for simple forms with a few text fields, where styling is easy. But when using
more complex form elements like tabs, accordion, entity autocomplete,
media library or entity browser, the amount of work required to get everything
to look (and work) good can be huge.

This module fixes this problem by rendering any layout builder forms inside an
iframe, with your admin theme.

Features

  • Completely isolated edit forms - no more CSS leaking
  • forms are rendered in the site's admin theme
  • Integrates seamlessly in the existing LB interface
  • Closes modal when the block is saved successfully
  • Scrolls to the previous position in the layout after the modal is closed
  • Works with translations (layout_builder_st)
  • Provides a new "Rebuild" action in the layout form

How does it work?

At its core, it provides a new Ajax renderer, which is based on
DialogRenderer. But instead of rendering the actual block edit form, it renders
an iframe, with the path of the form as the iframe source. It also appends a
destination query parameter to this url.

The custom ajax command handles setting up the dialog and attaches event
listeners to the iframe.

When submitting the block edit form and there were no errors, Drupal redirects
to the page provided in the destination parameter. This page includes a single
line of JavaScript which uses postMessage to notify the iframe's parent window.
The parent window listens for messages and will then close the modal and
trigger a rebuild of the Layout, so that it reflects the updated content.

Requirements

None, it should work with any standard Layout Builder setup.

Differences to layout_builder_modal

layout_builder_modal also shows the forms in a modal, but it renders them
directly in the page, using templates from your frontend theme and without any
CSS from the admin theme. This is the same behaviour as core Layout Builder.

This module just renders an iframe that contains the form rendered by Drupal in
the admin theme.

Activity

Total releases
4
First release
Feb 2025
Latest release
7 months ago
Release cadence
63 days
Stability
100% stable

Release Timeline

Releases

Version Type Release date
1.3.7 Stable Aug 27, 2025
1.3.6 Stable Mar 13, 2025
1.3.5 Stable Mar 5, 2025
1.3.4 Stable Feb 20, 2025