Decouple tree storage, introduce tree storage plugins

Created on 18 July 2024, 11 months ago

Overview

SdcController::layout() currently hard-codes loading the tree storage from a field named field_xb_demo.

We need to allow for multiple possible places to store component trees: they may originate from more places than just an XB field (for example: layout builder storage, paragraphs)

Proposed resolution

Add a plugin type for storage and use that instead - see https://git.drupalcode.org/project/experience_builder/-/merge_requests/68 for example - Component tree storage plugin and friends

User interface changes

πŸ“Œ Task
Status

Active

Component

Data model

Created by

πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

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

Comments & Activities

  • Issue created by @larowlan
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    This allows us to remove \Drupal\experience_builder\InternalXbFieldNameResolver::getXbFieldName, removes the restriction that nodes need to use a field called field_xb_demo and provides a bridge for Layout Builder and Paragraphs.

    So I think this should be a stable blocker

  • πŸ‡ΊπŸ‡ΈUnited States Kristen Pol Santa Cruz, CA, USA

    tagging for findability

  • Assigned to larowlan
  • Status changed to Postponed: needs info 13 days ago
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    We have \Drupal\experience_builder\Storage\ComponentTreeLoader + ComponentTreeEntityInterfacesince πŸ› Create a centralized service to handle loading component trees Active . That's a step towards this, in a way.

    But the issue summary is about going further, and loading e.g. Layout Builder trees into XB fields.

    Two thoughts:

    1. AFAICT some module could already decorate the ComponentTreeLoader service and live-transform e.g. a Layout Builder tree to an XB component tree.
      The only blocker: there's no interface for it yet.
    2. This kinda feels like the wrong abstraction layer to me. I think the better choice would be to not transform a LB tree to an XB component tree as described in docs/data-model.md#3.2 + 3.3, but instead to an XB client-side data model as described in #3.4.

      Why?

      Because:

      1. saving the LB-converted-to-XB component tree blindly (without performing validation) would be theoretically possible, but is highly probable to be imperfect and quit likely to be invalid. Loading it into the XB UI instead as if it were stored as an XB tree would be preferable, because it allows the content author to self-service upgrade but be confident about the result.
      2. it would introduce infrastructure (and hence pave the path) for taking various external-to-XB data sources, perhaps even external to the Drupal instance itself (think: Figma, an existing WordPress page, etc.), and allow loading that directly into XB's UI

    What am I missing? I'd swear that that second point is exactly what you told me, @larowlan, last summer? πŸ˜„πŸ˜…

    P.S.: either way, I don't see how the parent is relevant? We've got multiple component source plugins already by now.

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    Ooh I like that idea.

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    Which one? πŸ˜„

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    And just spotted where that second idea was written down by you: β€œjust in time loading”, in πŸ“Œ Add typed value-objects for the component tree structure Active .

Production build 0.71.5 2024