Tighten validation: only allow StaticPropSource in XB fields + PageTemplate, DynamicPropSource in ContentTypeTemplate

Created on 18 October 2024, 29 days ago

Overview

    First there was the ability to store XB Component trees in content entities, in the XB field type (\Drupal\experience_builder\Plugin\Field\FieldType\ComponentTreeItem and its tree + props field props).
  1. Then there was the ability to store XB Component trees in config, for the XB field type's default value (type: experience_builder.component_tree).
  2. Then a validation constraint was added that can consistently validate both of the above using the same logic: ValidComponentTree, added in πŸ“Œ Lift most logic out of ComponentTreeItem::preSave() and into a new validation constraint Needs work
  3. Then a second, more detailed validation constraint ComponentTreeStructure was added for the tree prop of a XB Component tree, in e πŸ“Œ Create validation constraint for ComponentTreeStructure Needs work
  4. Yesterday, a third validation constraint was added: ComponentTreeMeetRequirements, used by the new PageTemplate config entity, because while both of the above validation constraints are also in use and are still relevant, some kinds of XB Component trees just do not make sense at the "page" level: they cannot use DynamicPropSources (because the host entity, could be different for each page aka route/controller β€” or even none!). Added in πŸ“Œ Introduce an XB `PageTemplate` config entity Active
  5. Proposed resolution

    Use the new ComponentTreeMeetRequirements validation constraint on:

    1. βœ… β€” done in πŸ“Œ Introduce an XB `PageTemplate` config entity Active πŸ‘
    2. the XB field type (ComponentTreeItem), to disallow DynamicPropSource β€” because preliminary designs for 7.1 Tokens (see 🌱 Milestone 0.2.0: Experience Builder-rendered nodes Active ) indicate that only the site builder will be able to link XB Component props to DynamicPropSources on the host entity type, aka use base/bundle fields' values.
    3. if/when 🌱 [later phase] [META] 7. Content type templates β€” aka "default layouts" β€” affects the tree+props data model Active is worked on, the XB ContentTypeTemplate config entity allow both StaticPropSource and DynamicPropSource

    User interface changes

    None.

πŸ“Œ Task
Status

Active

Version

0.0

Component

Data model

Created by

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

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024