Skip to content
Snippets Groups Projects

Support unmapped asset_search_key value in asset file_properties or metadata

1 file
+ 6
4
Compare changes
  • Side-by-side
  • Inline
+ 6
4
@@ -60,11 +60,13 @@ final class MediaTypeResolver {
foreach ($this->getMediaTypes() as $media_type) {
$source = $media_type->getSource();
$definition = $source->getPluginDefinition();
if (!isset($mapping[$definition['asset_search_key']])) {
continue;
$property_name = $mapping[$definition['asset_search_key']] ?? $definition['asset_search_key'];
// Look for property in both file_properties and metadata.
$property_value = $asset['file_properties'][$property_name] ?? $asset['metadata']['fields'][$property_name] ?? '';
if (is_array($property_value)) {
$property_value = reset($property_value);
}
$property_name = $mapping[$definition['asset_search_key']];
$property_value = $asset['file_properties'][$property_name] ?? '';
// Compare the data type the actual source plugin can handle vs. the type
// of the current asset in question.
Loading