Content type templates, part 1: introduce a ContentTemplate config entity which always renders an empty component tree for a particular entity display

Created on 7 April 2025, about 1 month ago

Overview

This issue supersedes part of πŸ“Œ [PoC] Introduce a `ContentTypeTemplate` config entity Active , splitting it into a few smaller scopes just to keep the work more manageable, testable, and quickly iterative.

Proposed resolution

Let's introduce a new ContentTemplate config entity type, which implements EntityViewDisplayInterface and is tied to a specific entity type, bundle, and view mode. It should be able to instantiate a component tree, which (for now) is always empty. It should be used for rendering entities when viewing them in the relevant mode.

We will not support exposed slots in this issue; that will be a separate issue, since it adds a fair amount of complexity and would benefit from its own, focused issue and test coverage.

User interface changes

TBD

✨ Feature request
Status

Active

Version

0.0

Component

Theme builder

Created by

πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

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

Merge Requests

Comments & Activities

  • Issue created by @phenaproxima
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    Self-assigning to start on this.

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • Merge request !856Resolve #3517741 "Content type templates" β†’ (Merged) created by phenaproxima
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1038s
    #467668
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1059s
    #467675
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1559s
    #467689
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1136s
    #467702
  • Pipeline finished with Failed
    about 1 month ago
    Total: 2901s
    #467711
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1665s
    #467749
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1669s
    #467805
  • Pipeline finished with Canceled
    about 1 month ago
    Total: 317s
    #467831
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    Left some comments, looking slick

  • Pipeline finished with Failed
    about 1 month ago
    Total: 1399s
    #467832
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1664s
    #467839
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    OK, this is pretty much where I want it. After discussion with Lee and Matt, I don't think this needs anything more than kernel test coverage. We don't need to test actual rendering yet, since there's nowhere for the template to store the component tree (yet). We just need to ensure that the correct template is chosen in specific situations.

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1498s
    #467849
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • Pipeline finished with Failed
    about 1 month ago
    Total: 862s
    #468356
  • Pipeline finished with Failed
    about 1 month ago
    Total: 722s
    #468370
  • Pipeline finished with Canceled
    about 1 month ago
    Total: 623s
    #468377
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1396s
    #468381
  • Pipeline finished with Canceled
    about 1 month ago
    Total: 438s
    #468417
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1461s
    #468422
  • Pipeline finished with Failed
    about 1 month ago
    Total: 464s
    #468478
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1546s
    #468483
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1285s
    #468507
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1679s
    #468514
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1660s
    #468534
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    I think I've fixed all the feedback so far.

    After some discussion with @lauriii, the scope here can be reduced further. Wim pointed out that the "rendering algorithm" came sorta out of nowhere, so I asked @lauriii about it and he came up with the rendering flow he would actually like XB to implement. It's not in scope here, so I'm punting that to a separate issue that I have yet to open.

    So indeed, this issue is just about adding the ContentTemplate config entity (the class name was blessed by @lauriii), but not actually using it anywhere. That's a reasonable first step.

  • Pipeline finished with Canceled
    about 1 month ago
    Total: 256s
    #468562
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1518s
    #468564
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • Pipeline finished with Canceled
    about 1 month ago
    Total: 123s
    #468659
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1458s
    #468665
  • Pipeline finished with Failed
    about 1 month ago
    Total: 2003s
    #468683
  • Pipeline finished with Canceled
    30 days ago
    Total: 496s
    #469471
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    Thanks for extracting all the view builder-related things into ✨ Content templates, part 2: Using the templates for rendering Active β€” much clearer scope now!πŸ‘ And agreed with excluding exposed slots from this initial MR πŸ‘

    Found a few data integrity issues:

    • some config entity properties should be immutable but aren't yet
    • missing dependencies that should be calculated but aren't yet (but for which the logic already exist elsewhere in the XB codebase!)
    • missing validation for the stored component tree (for which all the validation logic already exists)
    • missing follow-up to validate that ContentTemplate config entities can only be created for eligible content entity types+bundles (this follow-up should itself be postponed on πŸ“Œ Allow XB to be used on all node types Active , but MUST be tagged )

    The new ViewModeExistsConstraintValidator really needs a core issue to fix it upstream; and the current name unfortunately suggests it's fine to keep around forever. We should rename it and point to the core issue to eventually remove it from XB.

    It's fine to defer some of the detailed test coverage to a follow-up, but with so many of the necessary validation foundations already existing in HEAD and this copying-and-expanding my PoC MR from πŸ“Œ [PoC] Introduce a `ContentTypeTemplate` config entity Active , I think it's reasonable to require this to be solid from the very start.

    Otherwise, I promise that the next step ( ✨ Content templates, part 2: Using the templates for rendering Active ) will immediately run into problems when it writes its test coverage πŸ˜…

  • Pipeline finished with Failed
    30 days ago
    Total: 1051s
    #469476
  • Pipeline finished with Failed
    30 days ago
    Total: 1594s
    #469482
  • Pipeline finished with Failed
    30 days ago
    Total: 1168s
    #469492
  • Pipeline finished with Failed
    30 days ago
    Total: 2042s
    #469506
  • Pipeline finished with Failed
    30 days ago
    Total: 1829s
    #469523
  • Pipeline finished with Failed
    30 days ago
    Total: 995s
    #469617
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • Pipeline finished with Failed
    30 days ago
    #469624
  • Pipeline finished with Failed
    30 days ago
    Total: 2493s
    #469640
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    Opened all relevant follow-ups and linked them in the code.

  • Pipeline finished with Failed
    30 days ago
    Total: 1481s
    #469699
  • Pipeline finished with Failed
    30 days ago
    Total: 1508s
    #469721
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    Thanks for opening all those follow-ups! This is looking fantastic. Doing a final review pass.

    FYI: I'm really scrutinizing this to make all subsequent issues A) simpler (because more actionable config schema errors will guide you!), B) hence need less of my attention πŸ˜„

  • Pipeline finished with Failed
    29 days ago
    Total: 1906s
    #470193
  • Pipeline finished with Failed
    29 days ago
    Total: 1688s
    #470288
  • Pipeline finished with Canceled
    29 days ago
    Total: 1041s
    #470440
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    I:

    1. enabled config schema checking for the new kernel test: https://git.drupalcode.org/project/experience_builder/-/merge_requests/8... β†’ automatically revealed bugs in the test coverage πŸ₯³
    2. Fixing that revealed that actually the depended upon JS Component did not exist.
    3. … and then a whole bunch more things, too many to enumerate, and in doing so I ended up realizing PageRegion(ValidationTest) was worse than this MR in some ways, so I made it catch up!

    Also: detailed guidance/pointers at:

    Epic work here!

  • Pipeline finished with Failed
    29 days ago
    Total: 2755s
    #470430
  • Pipeline finished with Success
    29 days ago
    Total: 2378s
    #470455
  • Pipeline finished with Skipped
    29 days ago
    #470485
  • πŸ‡ΊπŸ‡ΈUnited States mglaman WI, USA
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • Pipeline finished with Success
    29 days ago
    Total: 1586s
    #470482
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024