From 7feb27dbe4a27fdfff59b5120759be22ef706f56 Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Wed, 29 Nov 2023 05:14:56 -0400 Subject: [PATCH] Islandora IIIF: Check for missing hOCR in file fields. --- .../islandora_iiif/src/Plugin/views/style/IIIFManifest.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php index cc684069..e122a385 100644 --- a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php +++ b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php @@ -189,7 +189,7 @@ class IIIFManifest extends StylePluginBase { /** * @var \Drupal\taxonomy\TermInterface|null */ - $structured_text_term = $this->utils->getTermForUri($this->options['structured_text_term_uri']); + $structured_text_term = !empty($this->options['structured_text_term_uri']) ?$this->utils->getTermForUri($this->options['structured_text_term_uri']) : NULL; // @see https://iiif.io/api/presentation/2.1/#manifest $json += [ @@ -413,7 +413,9 @@ class IIIFManifest extends StylePluginBase { if (!is_null($ocr_field_name)) { $ocrs = $ocr_entity->{$ocr_field_name}; $ocr = isset($ocrs[0]) ? $ocrs[0] : FALSE; - $ocr_url = $ocr->entity->createFileUrl(FALSE); + if ($ocr) { + $ocr_url = $ocr->entity->createFileUrl(FALSE); + } } } elseif ($structured_text_term) {