Draft: Resolve #3591656: Support multi-target-bundle references in content-entity-reference props
Wires up the last mile of multi-target-bundle support for content-entity-reference code-component props. When a reference field targets several bundles, the coalesced expression carries a ReferencedBundleSpecificBranches target; this branch lifts the three blocks that stopped that working end to end.
Render path
JsComponent::buildReferencePayload() defers target selection until the referencer resolves, then selects the branch (or matching single-bundle target) for the resolved entity's entity-type + bundle. A referenced entity whose bundle has no matching branch yields a __type-only payload that carries the traversed entity's cacheability; a missing/deleted entity still yields NULL. Un-coalesced cross-bundle picks are only ever evaluated against entities of their own bundle.
Save-time validation
Removes MultiTargetBundleReferenceNotSupportedConstraint (constraint, validator, and its canvas.schema.yml registration). The internal-property, multi-valued-field, and resolvable-URIs validators now recurse into every branch of a ReferencedBundleSpecificBranches, so the guards the blanket rejection masked keep working.
Typed Data browser API
resolveReferenceTarget() offers per-bundle browsing for reference fields targeting more than one bundle; the fields endpoint emits one targetBundles entry (label + browse URL + single-bundle composed parent) per bundle. Per-bundle picks coalesce into one branch expression at save. The multi-bundle parent expression guard is unchanged (parents stay single-bundle by construction).
Testing instructions
-
ddev xb-phpunit tests/src/Kernel/Plugin/Canvas/ComponentSource/JsComponentTest.php --filter=MultiTargetBundle -
ddev xb-phpunit tests/src/Kernel/Config/JavaScriptComponentValidationTest.php -
ddev xb-phpunit tests/src/Kernel/Entity/JavaScriptComponentUpdateFromClientSideTest.php -
ddev xb-phpunit tests/src/Kernel/Controller/ApiUiContentEntityReferenceControllersTest.php - Playwright multi-bundle dialog case in
tests/src/Playwright/tests/isolatedPerTest/contentEntityReferenceProps.spec.ts -
composer phpcsandcomposer phpstanfrom the module root -
grep -rn "3591656" web/modules/contrib/canvas --include="*.php" --include="*.yml"returns nothing
AI usage disclosure
Implemented with AI assistance (Claude Code, Claude Opus 4.8), reviewed by the contributor before pushing, per Drupal.org's Policy on the use of AI.