Overview
#3530351: Decouple image+video (URI) shape matching from specific image+video file types/extensions is about avoiding assumptions in the shape definition about specific image file types.
This is about avoiding assumptions in XB's shape matching that require/assume the Standard install profile's image media type.
#3462709: Introduce `hook_storable_prop_shape_alter()`, use it to prefer the Media Library widget for "image" PropShape if Media Library is installed introduced in August 2024:
function media_library_storage_prop_shape_alter(CandidateStorablePropShape $storable_prop_shape): void {
if ($storable_prop_shape->shape->schema == ['type' => 'object', '$ref' => 'json-schema-definitions://experience_builder.module/image']) {
// @todo Allow configuring which media type, for now this assumes the
// Standard 'image' media type.
// @see core/profiles/standard/config/optional/media.type.image.yml
if (!MediaType::load('image')) {
return;
}
…
And this still lives on to this day. But what about sites without the image MediaType? Or sites with multiple image media types?
Proposed resolution
All MediaTypes that use the Image MediaSource plugin (\Drupal\media\Plugin\media\Source\Image) should be supported.
User interface changes
Multiple (all!) image-sourced media types should be selectable when using the Media Library Widget for populating a $ref: json-schema-definitions://experience_builder.module/image.

| Comment | File | Size | Author |
|---|---|---|---|
| #6 | multiple image media types.gif | 1.3 MB | wim leers |
Issue fork experience_builder-3530521
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
wim leersComment #3
wim leersThe initial hard technical blocker:
needs to be able to be
… but
\Drupal\Core\Entity\TypedData\EntityDataDefinition::create()does not allow that:Investigation led to discovering an upstream core issue for this: #2169813: Support deriving fields from entity definitions with multiple bundles (or zero bundles). Which … I happen to have contributed to 8 years ago for JSON:API. 😅👴
Comment #6
wim leersTests are passing, and are proving that it is now possible to target different fields (i.e. bundle-specific fields) of the same field type across multiple bundles of the same entity type.
This effectively makes this behave similarly to how #3487079: Pages have images usable for SEO purposes handled the picking of the the image to use in Metatags. (And this will automatically start happening on existing sites with this change.)
And … it actually works thanks to @bnjmnm's work on the Media Library Widget:
Future work
Note: the "same field type" requirement I referred to is simply because the props being targeted in each
FieldPropExpressioncannot (yet) vary by bundle; only the field name can. This could be expanded in a follow-up issue, which would allow for e.g. different media sources that all provide similar media: theImageMediaSource(powered by an image/file field type for local images), but a "remote image"MediaType— for example powered by core'sOEmbedMediaSource, using the (disabled by default)FlickroEmbed provider.Created #3530533: Support image shape matching against multiple bundles of multiple MediaSources (`image` + `oembed` + `acquia_dam_asset` + …) for that.
Comment #7
wim leersComment #8
wim leersTests are green! Follow-up for next steps exists.
Self-RTBC'ing and merging because nobody else knows the area well enough to review it.
Comment #10
wim leers