Skip to content

Commit

Permalink
Islandora IIIF: Address PHPCS errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
alxp committed Mar 18, 2024
1 parent 68bdbcf commit 0ae6b40
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public function render() {

$content_type = 'json';

// Add a search endpoint if one is defined
// Add a search endpoint if one is defined.
$this->addSearchEndpoint($json, $url_components);

// Give other modules a chance to alter the manifest.
Expand All @@ -251,6 +251,8 @@ public function render() {
* @param string $iiif_base_id
* The URL for the request, minus the last part of the URL,
* which is likely "manifest".
* @param \Drupal\taxonomy\TermInterface $structured_text_term
* The term representing the media use.
*
* @return array
* List of IIIF URLs to display in the Openseadragon viewer.
Expand Down Expand Up @@ -398,10 +400,8 @@ protected function getCanvasDimensions(string $iiif_url, FieldItemInterface $ima
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity at the current row.
* @param \Drupal\views\ResultRow $row
* Result row.
* @param int $delta
* The delta in case there are multiple canvases on one media.
* @param \Drupal\taxonomy\TermInterface $structured_text_term
* The term representing the media use.
*
* @return string|false
* The absolute URL of the current row's structured text,
Expand Down Expand Up @@ -476,6 +476,14 @@ protected function defineOptions() {
return $options;
}

/**
* Undocumented function
*
* @param array $json
* The IIIF manifest.
* @param array $url_components
* The search endpoint URL as array.
*/
protected function addSearchEndpoint(array &$json, array $url_components) {
$url_base = $this->getRequest()->getSchemeAndHttpHost();
$hocr_search_path = $this->options['search_endpoint'];
Expand All @@ -484,10 +492,10 @@ protected function addSearchEndpoint(array &$json, array $url_components) {
$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"),
"@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"),
];
}

Expand Down

0 comments on commit 0ae6b40

Please sign in to comment.