Spike: Explore adding configuration options to the tree item formatter to support alternate use-cases

Created on 12 May 2025, 27 days ago

Problem/Motivation

From #3462219-9: [META] Support alternative renderings of prop data added for the 'full' view mode such as for search indexing or newsletters β†’

Also thinking through the use-cases more above, I think they can be boiled down to three types. Each one assumes we are rendering a search index or newsletter or 'long teaser' view mode or any alternative rendering of the stuff we put in the full view mode.

1. Show everything in XB slots from the full view mode, except component type X

2. Show the first x deltas of specific component types from the XB slots on the full view mode. x deltas of x components. (testimonial, image gallery)

3. Show a few deltas of any component type, limited to a certain amount (long teaser)

Steps to reproduce

Proposed resolution

At present there's a primitive formatter for the XB `ComponentTreeitem` that essentially calls `::toRenderable` on the tree item. All the logic to take the tree data and convert it into a render array goes via the tree item.

In order to meet this use-case it would be simple enough to expand the formatter's settings to support the configuration options listed here i.e.

  • component type disallow/allow list
  • component type limits
  • component delta limits

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

0.0

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
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10
  • πŸ‡¬πŸ‡§United Kingdom catch

    In order to meet this use-case it would be simple enough to expand the formatter's settings to support the configuration options listed here i.e.

    component type disallow/allow list
    component type limits
    component delta limits

    At least from the description, I think this covers exactly what I was thinking of in the original issue.

    Feels likely that the UX will be complex - but it could be its own formatter plugin so that the default case doesn't have to show any config at all.

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

    component type disallow/allow list


    πŸ™ˆ Because this is about alternative renderings! Of course.

    Consider the implications for API consumers like JSON:API

    Why would a FieldFormatter plugin have any effect on API responses? πŸ€” Over at #3468272-34: Spike: Explore storing the ComponentTreeStructure field property one row per component instance β†’ .πŸ’‘.3, I just got really enthusiastic about how close JSON:API support now seems β€” I struggle to see how this ties into that.

    1. Applying those formatter settings to JSON:API implies filtering the component instances presented in the API response; but that filtering could be done client-side too?
    2. … unless the point is that the filters are controlled by the site builder aka server side, not the front-end developer. But then it still feels odd to have formatter (aka ~markup generator) settings apply to an API response?
    3. … unless the point is that the resulting markup is also made available via JSON:API somehow β€” similar to TextItemBase's processed field property?
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    Yeah the implications on JSON:API are copy pasta, removing that

  • πŸ‡¬πŸ‡§United Kingdom catch
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    We should ensure prior to 🌱 Milestone 1.0.0: Production Sites Postponed that this is all viable.

Production build 0.71.5 2024