Problem/Motivation

A Slot entity is only created via SlotsService::createSlot(). Layout Builder's slot block calls it eagerly, in SlotBlock::blockSubmit(), the moment the block is placed. The paragraphs behavior does not — SlotBehavior::submitBehaviorForm() only writes mode/slot_id/slot_label/cardinality into the paragraph's behavior settings. The only place that calls createSlot() for a paragraph-based slot is SlotsService::buildSlot(), reached solely through SlotBehavior::view() — i.e. only when the paragraph is rendered.

So a manually-typed slot ID (mode new/existing) on a Slot paragraph isn't a real, queryable Slot entity until the host content has been viewed at least once. Anything that looks up existing slot IDs before that point — e.g. the autocomplete/dropdown for a Block's Slot condition, driven by SlotsService::getSlotIds() — won't find it.

Steps to reproduce

  1. Add a Slot paragraph to a node, choose "Create new" or "Use existing", and type/select a slot ID.
  2. Save the node. Do not view it yet.
  3. Create a Block, add a Slot condition, and try to select that same slot ID — it isn't in the list.
  4. View the node once, then repeat step 3 — the slot ID now appears.

Proposed resolution

Call $this->slotsService->createSlot($slot_id, $slot_label) from SlotBehavior::submitBehaviorForm() when slot_id is non-empty, mirroring what SlotBlock::blockSubmit() already does for Layout Builder placements. default mode submits an empty slot_id (it's computed later, at render time, via tokens), so it's unaffected and keeps registering lazily as before.

Issue fork slots-3609475

Command icon 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

gashunk created an issue.