diff --git a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php index f0aca47da..42984eba8 100644 --- a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php +++ b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php @@ -494,17 +494,20 @@ protected function defineOptions() { */ protected function addSearchEndpoint(array &$json, array $url_components) { $url_base = $this->getRequest()->getSchemeAndHttpHost(); - $hocr_search_path = $this->options['search_endpoint']; - $hocr_search_url = $url_base . '/' . ltrim($hocr_search_path, '/'); + $hocr_search_path = $this->options['search_endpoint'] ?? null; - $hocr_search_url = str_replace('%node', $url_components[1], $hocr_search_url); + if ($hocr_search_path) { + $hocr_search_url = $url_base . '/' . ltrim($hocr_search_path, '/'); - $json['service'][] = [ - "@context" => "http://iiif.io/api/search/0/context.json", - "@id" => $hocr_search_url, - "profile" => "http://iiif.io/api/search/0/search", - "label" => t("Search inside this work"), - ]; + $hocr_search_url = str_replace('%node', $url_components[1], $hocr_search_url); + + $json['service'][] = [ + "@context" => "http://iiif.io/api/search/0/context.json", + "@id" => $hocr_search_url, + "profile" => "http://iiif.io/api/search/0/search", + "label" => t("Search inside this work"), + ]; + } } /**