Draft: feat: #3585354 add content-entity-types / fields endpoints for entity reference selection UI
Adds two read-only HTTP endpoints that an entity-reference selection UI (the postponed [#3585355]) will consume:
GET /canvas/api/v0/ui/entity-reference/content-entity-types— fieldable content entity types and their bundles, filtered by per-bundle view access. Bundle-less entity types are surfaced with a single self-named bundle.GET /canvas/api/v0/ui/entity-reference/fields/{entity_type}/{bundle}— field descriptors with pre-built expression strings. An optional?parent=<expression>chains the response to a reference path so the UI can lazily expand reference fields without constructing expressions itself.
Per-bundle and per-field view access checks run against an unsaved stub entity so internal fields (e.g. the user pass hash) are not surfaced. Every hop in a ?parent= chain is also access-checked.
Image, file, link, and entity references targeting a Media bundle with a known source (Image, VideoFile) surface as a single object expression rather than an expandable reference — mirroring ShapeMatchingHooks::getObjectProps(). The per-field-type editorial knowledge has been extracted into a new FieldExpressionDeriver service so it isn't duplicated.
AI-Generated: Yes (Used Claude (Opus 4.7) to create plan / code).
Testing instructions
- Automated tests.
- Go to https://xb-dev.ddev.site/canvas/api/v0/ui/entity-reference/content-entity-types
- Go to https://xb-dev.ddev.site//canvas/api/v0/ui/entity-reference/fields/node/article
- Go to https://xb-dev.ddev.site/canvas/api/v0/ui/entity-reference/fields/taxonomy_term/tags?parent=%E2%84%B9%EF%B8%8E%E2%90%9Centity:node:article%E2%90%9Dfield_tags%E2%90%9E%E2%90%9Fentity%E2%90%9C%E2%90%9Centity:taxonomy_term:tags%E2%90%9Dname%E2%90%9E%E2%90%9Fvalue
Closes #3585354
Edited by Christian López Espínola