fix(Data model): #3591699 Never expose entity-reference inputs (e.g. image src) as translatable

Closes #3591699 (closed)

AI-Generated: Yes (investigation, fix and regression test authored with Claude Code Opus 4.8; reviewed and committed by the author).

What this MR does

A component input's translatability is decided from its JSON Schema shape alone. An image src backed by an entity reference has a URI-string shape, so it was offered for config translation (e.g. via tmgmt_config). Translating it stored an (empty) value in the language override, which shadowed the base reference and broke rendering of the translated component (a Twig\RuntimeError, while the rest of the page still rendered).

JsonSchemaPropsComponentInstanceInputsConfigSchemaGenerator now also considers the prop's field type expression: inputs backed by an entity reference (entity_reference, image, file, media) are excluded from translatability, decided dynamically from the component's field definition (no stored flag). Inputs that merely look like URIs but hold author-entered literals (e.g. a remote-image src) stay translatable.

Testing steps

  • Install Canvas; add a second language and a config-translation workflow (e.g. tmgmt_config).
  • Add a ContentTemplate (or PageRegion) with a component whose image src is an entity reference (e.g. card-with-stream-wrapper-image).
  • Translate it: the image is not offered for translation, and no empty override is stored.
  • View the entity in the second language: the component renders (no Twig\RuntimeError).
  • Confirm string / rich-text / link props remain translatable.

Notes for reviewers

  • The fix lives in the shared generator used by both SDC and code (JS) component sources, so it applies to both.
  • The regression test (ConfigWithComponentTreeConfigTranslationUiTest::testEntityReferenceInputsAreNotTranslatable) is SDC-only on purpose: a code component cannot express a reference-backed string prop — the canvas.json_schema.prop_shape.string config schema disallows contentMediaType: image/* and x-allowed-schemes — so its image is an object prop, which is never translatable by shape and would pass with or without the fix.

Merge request reports

Loading