feat(Data model): #3591638 Add a computed `src` field property to the image field type

Closes #3591638 (closed)

What this MR does

Adds a computed, non-internal src property to the image field type that is a DX alias of src_with_alternate_widths: same ComputedUrlWithQueryString resolution, same resolved URL (the ?alternateWidths query string is included). The point is the name — code components and the content-entity-reference picker can reference a clean src without exposing the internal src_with_alternate_widths implementation detail.

src is marked ->setSetting('is source for', 'src_with_alternate_widths'), so the shape matcher (and FieldInstanceSupportTest) skip it — automatic shape matching is unchanged and keeps resolving src_with_alternate_widths (the responsive variant). src is intended for direct selection in the entity-reference UI (#3585354 / #3585355).

Adding computed field properties to field types isn't sustainable long-term: there's a @todo to replace this with adapters (https://www.drupal.org/project/canvas/issues/3464003). ⚠️ That switch will require an update path for all component trees consuming this property.

Testing steps

  • Automated tests pass.
  • Confirm image-shaped props still shape-match to src_with_alternate_widths (no change).

AI-Generated: Yes (Used Claude (Opus 4.8) to create plan / code).

Edited by Christian López Espínola

Merge request reports

Loading