Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 12 additions & 16 deletions src/View/Helper/UniversalViewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,38 +135,34 @@ public function __invoke($resource, $options = []): string
return '';
}

// Determine the url of the manifest from a field in the metadata.
$externalManifest = $view->iiifManifestExternal($resource, $iiifServerIsActive);
if ($externalManifest) {
return $this->render($externalManifest, $options, $resourceName);
}

// If the manifest is not provided in metadata, point to the manifest
// created from Omeka files if the module Iiif Server is enabled.
if (!$iiifServerIsActive) {
return '';
}

// Some specific checks.
switch ($resourceName) {
case 'items':
/** @var \Omeka\Api\Representation\ItemRepresentation $resource */
// Currently, an item without files is unprocessable.
$medias = $resource->media();
if (!count($medias)) {
// return $view->translate('This item has no files and is not displayable.');
return '';
}
break;
case 'item_sets':
/** @var \Omeka\Api\Representation\ItemSetRepresentation $resource */
if (!$resource->itemCount()) {
// return $view->translate('This collection has no item and is not displayable.');
return '';
}
break;
}

// Determine the url of the manifest from a field in the metadata.
$externalManifest = $view->iiifManifestExternal($resource, $iiifServerIsActive);
if ($externalManifest) {
return $this->render($externalManifest, $options, $resourceName);
}

// If the manifest is not provided in metadata, point to the manifest
// created from Omeka files if the module Iiif Server is enabled.
if (!$iiifServerIsActive) {
return '';
}

$urlManifest = $view->iiifUrl($resource);
return $this->render($urlManifest, $options, $resourceName);
}
Expand Down