[2.0.0-beta2] Drag & drop support in layout builder

Created on 31 July 2024, 5 months ago
Updated 15 September 2024, 3 months ago

Problem/Motivation

When using components as layouts, we can't drag and drop blocks inside a slot (layout's region) or between slots.

Similar UI Patterns 1.x issue: 🐛 Layout Builder: drag&drop of blocks inside component slots is not working Active

Proposed resolution

This seems to work:

--- a/modules/ui_patterns_layouts/src/Element/ComponentAlterer.php
+++ b/modules/ui_patterns_layouts/src/Element/ComponentAlterer.php
@@ -41,6 +41,12 @@ class ComponentAlterer implements TrustedCallbackInterface {
       }
       if (isset($element[$region_id]['#attributes'])) {
         $element['#region_attributes'][$region_id] = new Attribute($element[$region_id]['#attributes']);
+        $element["#slots"][$region_id] = [
+          "#type" => "html_tag",
+          "#tag" => "div",
+          "#attributes" => $element[$region_id]['#attributes'],
+          "content" => $element["#slots"][$region_id],
+        ];
       }
       unset($element[$region_id]);
     }

Remaining tasks

What about UI Styles ?

📌 Task
Status

Fixed

Version

2.0

Component

UI Patterns Layouts

Created by

🇫🇷France pdureau Paris

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024