[2.0.5] Merge VS append in slots

Created on 29 May 2025, 5 days ago

Problem/Motivation

In last release, we added this code: https://git.drupalcode.org/project/ui_patterns/-/commit/af7f07d7776b831d...

    // Merge original slot content if it exists.
    if ($original_slot !== NULL) {
      $build['#slots'][$slot_id][] = $original_slot;
    }

There may be 2 issues here:

  • The comment says "merge" but the code says "append"
  • On display builder, I have duplicated in slots with the append, but not with the merge (by removing [])

Proposed resolution

Is the comment wrong? Or do we need to adapt display builder?

📌 Task
Status

Active

Version

2.0

Component

Code

Created by

🇫🇷France pdureau Paris

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

Comments & Activities

  • Issue created by @pdureau
  • 🇫🇷France pdureau Paris

    Will be done directly in display_builder:

    diff --git a/src/Plugin/display_builder/Island/BuilderPanel.php b/src/Plugin/display_builder/Island/BuilderPanel.php
    index 1411306..d8a628b 100644
    --- a/src/Plugin/display_builder/Island/BuilderPanel.php
    +++ b/src/Plugin/display_builder/Island/BuilderPanel.php
    @@ -115,6 +115,8 @@ class BuilderPanel extends IslandPluginBase {
     
         foreach ($component['slots'] ?? [] as $slot_id => $definition) {
           $build['#slots'][$slot_id] = $this->buildComponentSlot($builder_id, $slot_id, $definition, $data, $instance_id);
    +      // Prevent the slot to be generated again.
    +      unset($build['#ui_patterns']['slots'][$slot_id]);
         }
     
         if ($this->isEmpty($build)) {
    
Production build 0.71.5 2024