feat(Internal HTTP API): #3591669 Heuristics for the content-entity-reference selection UI
Closes #3591669
What this MR does
Applies two heuristics to the content-entity-reference selection UI ("Typed Data browser" picker) so it only offers data a Code Component Developer can meaningfully consume:
- Image field (
ApiUiContentEntityReferenceControllers::buildFieldEntry()): the picker listed the same image URL twice —srcand thesrc_with_alternate_widthsit is cloned from — plussrcset_candidate_uri_template, a raw RFC 6570 URI template. It now offers only the developer-facingsrc, relabelled "Image URL" inImageItemOverride, and excludes the two implementation-detail computed properties by name. Done picker-side only, soPropSourceSuggesterkeeps offering them (it has different needs). - Translation/revision metadata (
ApiUiContentEntityReferenceControllers::listFields()): a newisConsideredIrrelevant()heuristic hidesdefault_langcode,revision_log,revision_translation_affected, and thecontent_translation_source/content_translation_outdatedbase fields. None are marked internal, so the existing internal-field rule could not reach them; the heuristic mirrors the intent ofPropSourceSuggester::isConsideredIrrelevant()but is deliberately separate (the picker offers a reference'starget_id, which the suggester hides).
The two concerns are in separate commits for reviewability.
Testing steps
- Apply the branch, enable the
canvas_dev_ermodule (the feature flag for content-entity-reference props) and clear caches. - In the code editor, add a
Content entity referenceprop and browse into a bundle that has an image field. - Confirm the image field offers a single "Image URL" property — not "Resolved image URL with ?alternateWidths query parameter", a duplicate, or the srcset template.
- Browse into a translatable, revisionable content type (e.g. an Article with translation enabled).
- Confirm "Default translation", "Revision translation affected", "Translation source", "Translation outdated" and "Revision log message" are not offered, while real fields (including the entity's own
langcode) still are. - Automated coverage:
ApiUiContentEntityReferenceControllersTest(updated image test + newtestFieldsEndpointOmitsTranslationAndRevisionMetadataFields).
Notes for reviewers
- Hiding the image twins is done in the controller, not at the field-type level: marking them internal there would also hide them from
PropSourceSuggester, which still relies onsrc_with_alternate_widthsandsrcset_candidate_uri_template.'is source for'can't drive it either — the matcher reads it the other way around (it hidessrc). - The image twins are excluded by name (not "keep only
src") so any future image property stays offered by default. src_with_alternate_widthsis slated for removal in #3591648; the metadata heuristic uses literal field names where core'sgetRevisionMetadataKey()does not resolve (revision_translation_affectedcomes from core defaults, not the node annotation).
AI usage
AI-Generated: Yes (used Claude Code to plan, implement and write tests).