diff --git a/module/VuFind/src/VuFind/RecordDriver/Feature/IiifAwareTrait.php b/module/VuFind/src/VuFind/RecordDriver/Feature/IiifAwareTrait.php new file mode 100644 index 00000000000..fbf6b16f6e3 --- /dev/null +++ b/module/VuFind/src/VuFind/RecordDriver/Feature/IiifAwareTrait.php @@ -0,0 +1,66 @@ +. + * + * @category VuFind + * @package RecordDrivers + * @author Ronja Koistinen + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development:plugins:record_drivers Wiki + */ + +namespace VuFind\RecordDriver\Feature; + +/** + * Additional functionality for IIIF in Finna + * + * @category VuFind + * @package RecordDrivers + * @author Ronja Koistinen + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development:plugins:record_drivers Wiki + */ +trait IiifAwareTrait +{ + /** + * Get all IIIF manifests. + * + * @return array + */ + public function getIiifManifests(): array + { + return []; + } + + /** + * Checks that the content type corresponds to a IIIF Presentation manifest + * + * @param string $contentType Content type to check + * + * @return bool + */ + public function isIiifPresentationManifest(string $contentType): bool + { + $iiifManifestContentTypeRegex = + '/application\/ld(\+json)?;profile="http:\/\/iiif\.io\/api\/presentation\/.+\.json"/'; + return preg_match($iiifManifestContentTypeRegex, $contentType) === 1; + } +}