Skip to content

Commit

Permalink
WIP: Fixing default thumbnail media type.
Browse files Browse the repository at this point in the history
  • Loading branch information
MorganDawe committed Dec 13, 2024
1 parent f5dab0a commit 6e43f04
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Plugin/search_api/processor/DgiImageDiscovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,18 @@ protected function getDefaultImageFromTaxonomy(NodeInterface $node, ImageStyleIn
if (!$node->hasField('field_model')) {
return NULL;
}

$model_terms = $node->get('field_model')->referencedEntities();

foreach ($model_terms as $term) {
if ($term instanceof Term) {
// Load the media entity referenced by the field_default_image.
$media = $term->get('field_default_image')->entity;

// Default content loaded from term returns file, so this use case
// adds support for islandora models with configured default thumbnails.
if ($media instanceof File) {
return $image_style->buildUrl($media->getFileUri());
}
if ($media instanceof Media) {
// Load the file entity from the media entity.
$file = $media->get('field_media_image')->entity;
Expand Down

0 comments on commit 6e43f04

Please sign in to comment.