- Issue created by @wim leers
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
The initial hard technical blocker:
new FieldPropExpression(EntityDataDefinition::create('media', 'image'), β¦)
needs to be able to be
new FieldPropExpression(EntityDataDefinition::create('media', ['image', 'acquia_dam_image']), β¦)
β¦ but
\Drupal\Core\Entity\TypedData\EntityDataDefinition::create()
does not allow that:public static function create($entity_type_id = NULL, $bundle = NULL) {
Investigation led to discovering an upstream core issue for this: #2169813: Support deriving fields from entity definitions with multiple bundles β . Which β¦ I happen to have contributed to 8 years ago for JSON:API. π π΄
- Merge request !1150Resolve #3530521 "Shape matching multiple bundles" β (Merged) created by wim leers
- πΊπΈUnited States bnjmnm Ann Arbor, MI
wim leers β credited bnjmnm β .
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
Tests 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 π Pages have images usable for SEO purposes Active 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
FieldPropExpression
cannot (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: theImage
MediaSource
(powered by an image/file field type for local images), but a "remote image"MediaType
β for example powered by core'sOEmbed
MediaSource
, using the (disabled by default)Flickr
oEmbed provider.Created π Support image shape matching from the `image` MediaSource: support both the `image` + `oembed` MediaSources simultaneously Active for that.
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
Tests are green! Follow-up for next steps exists.
Self-RTBC'ing and merging because nobody else knows the area well enough to review it.
-
wim leers β
committed cb4c5a3d on 0.x
Issue #3530521 by wim leers, bnjmnm: Decouple image shape matching from...
-
wim leers β
committed cb4c5a3d on 0.x