- Issue created by @danflanagan8
- Merge request !159Support unmapped asset_search_key value in asset file_properties or metadata β (Open) created by danflanagan8
- πΊπΈUnited States danflanagan8 St. Louis, US
I put in an MR. Setting to NR.
- First commit to issue fork.
- πΊπΈUnited States patrickfweston Columbus, Ohio
This is going to be really necessary for a client I'm working with. They have asset types that support both Word/Excel documents and PDFs. I'm having trouble at the moment given they have different AssetMediaSource instances, using both the
Documents
andPdf
types. - πΊπΈUnited States japerry KVUO
I think this is on the right path, would like some tests though. Probably should look at how we're hard coding the mappings as well, so you don't need to use a hook_alter.
- πΊπΈUnited States danflanagan8 St. Louis, US
Hi, @japerry
Probably should look at how we're hard coding the mappings as well, so you don't need to use a hook_alter.
The hook_alter is required in my case because all the asset plugin classes are final, not so much because the mappings are hardcoded. If the image plugin weren't final I probably would have extended it to create my new icon plugin, but I think the hook is fine here.
I think this is on the right path
Yeah, I think for supporting a single asset_search_key and a single asset_search_value, the MR is pretty effective. One problem that still comes up for my image/icon example is that any asset that Drupal resolves as an icon must all resolve as an image. So it's vital that the MediaTypeResolver tries to resolve icons before it tries to resolve images. I'm pretty sure the resolver iterates through the media types in alphabetical order (by media type machine name). Luckily for us, our icon media (which uses our icon asset type) comes before our image media (using the image asset type). That's pretty darn lucky though!
TL;DR; It would be nice to be able to set the weight of a media type as returned by
MediaTypeResolver:: getMediaTypes
.