Problem/Motivation
This is a regression introduced in 1.0.0-rc2, affecting block preprocessing when the enhanced UI is enabled.
When the enhanced UI is enabled, BlockComponentRenderArray::onBuildRender() moves the original block content from content to content['component'] before hook_preprocess_block() runs.
Block preprocessors therefore receive a different content structure, which can break logic that accesses or modifies its child elements and properties.. This can make the IPE preview differ from the normal page. For example, preprocessing that adjusts the order or placement of a block’s content may no longer work as expected in the editing preview.
Steps to reproduce
- Enable Layout Builder IPE and Enhance the default Layout Builder UI.
- Add a block with a named child such as
comment. - Read or move that child in
hook_preprocess_block(). - Compare the normal page with the IPE editing preview. The child is direct content normally, but nested under
content['component']in IPE.
Proposed resolution
Add the enhanced before/after controls through a theme wrapper on the outer, uncacheable preview component, leaving the block content unchanged. This preserves preprocessing, render caching and lazy builders. JavaScript positions the controls inside their owning block, keeping them hidden until positioned to avoid layout shifts.
Remaining tasks
Review and test MR !11.
Review and test the patch on the supported Drupal versions.
User interface changes
None intended.
API changes
None.
Data model changes
None.
Issue fork layout_builder_ipe-3620545
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
berliner commentedComment #4
berliner commentedComment #5
berliner commentedComment #6
berliner commentedComment #8
berliner commentedReleased as part of 1.0.0-rc3.