Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

This module renders Layout Builder's edit forms within an iframe, utilizing the admin theme for a more isolated and consistent experience. This approach prevents CSS conflicts and ensures that complex form elements display correctly, improving the usability of Layout Builder for editors.

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
5
First release
Feb 2025
Latest release
1 week ago
Releases (12 mo)
2 ▼ from 3
Maintenance
Active

Release Timeline

Releases

Version Type Release date
1.3.8 Stable Jul 9, 2026
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