Browse Source

Islandora IIIF: Check for missing hOCR in file fields.

959-hocr-tiff-performance
Alexander O'Neill 1 year ago
parent
commit
7feb27dbe4
  1. 4
      modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php

4
modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php

@ -189,7 +189,7 @@ class IIIFManifest extends StylePluginBase {
/** /**
* @var \Drupal\taxonomy\TermInterface|null * @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 // @see https://iiif.io/api/presentation/2.1/#manifest
$json += [ $json += [
@ -413,9 +413,11 @@ class IIIFManifest extends StylePluginBase {
if (!is_null($ocr_field_name)) { if (!is_null($ocr_field_name)) {
$ocrs = $ocr_entity->{$ocr_field_name}; $ocrs = $ocr_entity->{$ocr_field_name};
$ocr = isset($ocrs[0]) ? $ocrs[0] : FALSE; $ocr = isset($ocrs[0]) ? $ocrs[0] : FALSE;
if ($ocr) {
$ocr_url = $ocr->entity->createFileUrl(FALSE); $ocr_url = $ocr->entity->createFileUrl(FALSE);
} }
} }
}
elseif ($structured_text_term) { elseif ($structured_text_term) {
$parent_node = $this->utils->getParentNode($entity); $parent_node = $this->utils->getParentNode($entity);
$ocr_entity_array = $this->utils->getMediaReferencingNodeAndTerm($parent_node, $structured_text_term); $ocr_entity_array = $this->utils->getMediaReferencingNodeAndTerm($parent_node, $structured_text_term);

Loading…
Cancel
Save