Problem/Motivation

🛑 Blocked on #3452397: Allow specifying default props values when opting an SDC in for XB.

SDC's optionally have examples.
⇒ They're not guaranteed to be present.
⇒ A preview is not guaranteed to work. 😱

This was fortunately fixed months ago. But it's achieved through hacky work-arounds rather than using the single source of Truth: XB's Component config entities.

Proposed resolution

  1. Require every opted in SDC to have a default value specified for every required SDC prop — #3463999: Auto-create/update Component config entities for all discovered SDCs that meet XB's minimum criteria implemented that in \Drupal\experience_builder\Plugin\ComponentPluginManager::componentMeetsRequirements() (with a fix in #3470550: Component config entities are incomplete: missing entries for optional props, causing errors in ComponentPropsForm for an oversight).
  2. Update \Drupal\experience_builder\Controller\SdcController() to use that new default.
  3. Delete \Drupal\experience_builder\Controller\SdcController::populatePropValues() and ::getDefaultValueFromPropInfo()

User interface changes

None.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

Issue summary: View changes
wim leers’s picture

Title: [PP-1] API: update /xb-render-component/{component_id} to use Component config entity's default values » [PP-1] HTTP API: update /xb-render-component/{component_id} to use Component config entity's default values
wim leers’s picture

Priority: Normal » Major
Issue tags: +blocker
Related issues: +#3452512: Add component instance edit form to contextual panel
wim leers’s picture

Title: [PP-1] HTTP API: update /xb-render-component/{component_id} to use Component config entity's default values » HTTP API: update /xb-render-component/{component_id} to use Component config entity's default values
Assigned: Unassigned » wim leers
Status: Postponed » Active
wim leers’s picture

wim leers’s picture

Assigned: wim leers » bnjmnm
Status: Active » Needs review
wim leers’s picture

StatusFileSize
new1.74 MB

With this in place:

bnjmnm made their first commit to this issue’s fork.

wim leers’s picture

Oops, sorry for overwriting your merging of upstream commits, @bnjmnm, that was unintentional 😅

wim leers’s picture

Assigned: bnjmnm » wim leers
Status: Needs review » Postponed

Working to get this issue's status/relevance updated, but blocked on @lauriii's confirmation at #3463999-7: Auto-create/update Component config entities for all discovered SDCs that meet XB's minimum criteria.

wim leers’s picture

Component: Page builder » Config management
Assigned: wim leers » f.mazeikis
Status: Postponed » Active
Issue tags: -blocker

This is no longer a blocker though.

#3463999: Auto-create/update Component config entities for all discovered SDCs that meet XB's minimum criteria is now in. Thanks to that issue, the following if-test is obsolete — that is now a requirement for an SDC to become available in XB:

      // @todo Revisit in https://www.drupal.org/project/experience_builder/issues/3455942.
      if ((isset($prop_info['examples']) && isset($prop_info['examples'][0])) || in_array($prop_name, $metadata->schema['required'] ?? [])) {
wim leers’s picture

Assigned: f.mazeikis » wim leers

I'll push this forward tomorrow. It's been lingering too long, and I'd like @f.mazeikis to remain focused on #3475584: Add support for Blocks as Components.

wim leers’s picture

Now properly ready for review! 😊

wim leers’s picture

Title: HTTP API: update /xb-render-component/{component_id} to use Component config entity's default values » HTTP API: update /xb-components to use Component config entity's default values

My title update was lost 😬

P.S.: @f.mazeikis: Cypress E2E tests pass locally, they are currently super slow on GitLab CI. That's likely due to ephemeral load issues. Please re-run the pipeline when you review this, I bet it'll be green.

f.mazeikis’s picture

Status: Needs review » Reviewed & tested by the community

Re-ran pipeline and it's now passing. Code looks good too - certainly an improvement, even if we still need to come back to this once we have solutions for datetime and image (and entity references in general) props handling.

wim leers’s picture

Assigned: f.mazeikis » Unassigned
Status: Reviewed & tested by the community » Fixed

  • wim leers committed 248b96a8 on 0.x
    Issue #3455942 by wim leers, bnjmnm, f.mazeikis: HTTP API: update /xb-...
wim leers’s picture

Assigned: f.mazeikis » Unassigned
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.