[PP-1] Validate that content templates are attached to entity bundles that fulfill XB's requirements

Created on 9 April 2025, 4 months ago

Overview

Postponed on 📌 Allow XB to be used on all node types Active .

The ContentTemplate config entity is attached to a specific entity type, bundle, and view mode. At the moment, we only require that the bundle exist at all, but we don't check that the bundle is actually usable by XB. We should validate that, but it'll have to happen once the blocker is in.

Proposed resolution

TBD

User interface changes

TBD

Feature request
Status

Postponed

Version

0.0

Component

Miscellaneous

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
  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
  • Assigned to lauriii
  • Status changed to Postponed: needs info 20 days ago
  • 🇺🇸United States effulgentsia

    The assumption the way this issue is worded is that XB should only allow content templates for entity types and bundles for which XB will be able to allow editing individual entities of. For example, only entity types that implement EntityPublishedInterface. But I wonder if that's correct, so assigning to @lauriii. Because another way we can go here is to allow content templates for all entity types and bundles, even ones for which editing the individual entities can only be done outside of XB. For example, we could release XB 1.0.0 with the ability to edit content templates for nodes but not yet the ability to edit the individual nodes within XB. And if we can do that for nodes, then why not for content entity types that XB might never provide the ability to edit the individual entities of?

  • 🇺🇸United States effulgentsia

    Also, what might make sense here is for XB 1.0.0 to only allow content templates for nodes, and punt any support for creating templates for other entity types (e.g., paragraphs, custom blocks, etc.) to after 1.0.0.

  • 🇫🇮Finland lauriii Finland

    I agree that EntityPublishedInterface seems indeed like a restriction for editing entity content in XB, not to build templates for the entity. I'm wondering if relying on the existence of view_builder for the entity type would be too broad?

  • 🇫🇮Finland lauriii Finland

    Content Templates is still a priority for stable, but we're tracking it separately.

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    Also, what might make sense here is for XB 1.0.0 to only allow content templates for nodes, and punt any support for creating templates for other entity types (e.g., paragraphs, custom blocks, etc.) to after 1.0.0.

    +1 — this is what I was thinking. Assuming we do that, I agree with removing the tag, if we first land a basic MR here that does this:

    diff --git a/config/schema/experience_builder.schema.yml b/config/schema/experience_builder.schema.yml
    index 6e2c4c78f..7aa46c156 100644
    --- a/config/schema/experience_builder.schema.yml
    +++ b/config/schema/experience_builder.schema.yml
    @@ -718,6 +718,8 @@ experience_builder.content_template.*.*.*:
             PluginExists:
               manager: entity_type.manager
               interface: Drupal\Core\Entity\ContentEntityInterface
    +        Choice:
    +          - node
         content_entity_type_bundle:
           type: string
           label: 'Bundle'
    

    (And then keep the issue open for the wider scope.)

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    MR up for #7. Assigned to @lauriii for review — if he approves/merges, then I'm happy to remove the tag 👍

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    Adjusting title temporarily for the MR up for review in #9. Once it's in, we should restore the title [PP-1] Validate that content templates are attached to content entity types (+ bundles) that fulfill XB's requirements.

  • 🇫🇮Finland lauriii Finland

    Approved

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    Hah, the tests are failing legitimately:

    Drupal\Tests\experience_builder\Functional\Update\CollapseComponentInputsUpdateTest::testCollapseInputs
    Violations exist for Content template xb_page.xb_page.reverse: content_entity_type_id: The value you selected is not a valid choice.
    Failed asserting that actual size 1 matches expected size 0.
    

    This is because 📌 Don't allow passing uncollapsed inputs if using default expression Active just introduced a ContentTemplate for xb_page — whereas xb_page content entities should never get content templates, because they're explicitly intended for one-off (landing) pages! 😅 This just reaffirms my belief we should strictly validate config.

  • Pipeline finished with Skipped
    5 days ago
    #570917
  • Pipeline finished with Skipped
    5 days ago
    #570918
    • wim leers committed 843e7b0b on 1.x
      Issue #3518272 by wim leers, lauriii, effulgentsia: Initially, only...
  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    Thanks, @lauriii!

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    Because another way we can go here is to allow content templates for all entity types and bundles, even ones for which editing the individual entities can only be done outside of XB.

    That'd mean a very bifurcated experience: some things can be edited in XB, some things cannot, etc. It also means going back to the usability reality that has frequently been lamented: being forced to navigate a complex, abstract admin UI where the connections between concepts are hard to discover and hence require a steep learning curve.

    We might need to do this eventually to bring support for the full suite of content entity types in Drupal core & contrib. But … I don't think that's necessary at this time. I would urge to pretty please do this in a multi-phased approach:

    1. no content template support (the reality in https://www.drupal.org/project/experience_builder/releases/0.7.3-alpha1 )
    2. node content template support (see #7 and its MR)

      Yes, @lauriii is right in #5 that EntityPublishedInterface is about the content entity editing experience, because XB's current auto-save architecture needs the ability to publish (to work at all).

      While we may very well be targeting only the "pure" ContentTemplate part for 1.0/DrupalCon Vienna,

      Once that's the case, it'll also be reasonable to expect that the "navigator" in the top bar allows searching not only Page content entities, but any content that can be created or edited in XB, so also for example nodes. And so on and so on. Which is exactly why the list of eligibility criteria in 📌 Allow XB to be used on all node types Active is what it is.

  • Pipeline finished with Success
    5 days ago
    #570899
Production build 0.71.5 2024