Skip to content

Commit

Permalink
Avoid attempting to use potentially non-existent field.
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-vessey committed Sep 20, 2024
1 parent 9ccac04 commit e93592b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Plugin/search_api/processor/DgiImageDiscovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ public function addFieldValues(ItemInterface $item) {
*/
protected function getDefaultImageFromTaxonomy(NodeInterface $node, string $image_style_name) {
$default_image_url = NULL;

if (!$node->hasField('field_model')) {
return NULL;
}

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

foreach ($model_terms as $term) {
Expand Down

0 comments on commit e93592b

Please sign in to comment.