diff --git a/openseadragon.module b/openseadragon.module index 695e529..62d1ff9 100644 --- a/openseadragon.module +++ b/openseadragon.module @@ -69,7 +69,9 @@ function template_preprocess_openseadragon_formatter(&$variables) { if (!empty($tile_sources)) { $viewer_settings['sequenceMode'] = count($tile_sources) > 1 && !$viewer_settings['collectionMode']; - + $variables['#attached']['library'] = [ + 'openseadragon/init', + ]; $variables['#attached']['drupalSettings']['openseadragon'][$openseadragon_viewer_id] = [ 'basePath' => Url::fromUri($iiif_address), 'fitToAspectRatio' => $viewer_settings['fit_to_aspect_ratio'], @@ -93,9 +95,6 @@ function template_preprocess_openseadragon_iiif_manifest_block(&$variables) { // Load the global settings. $config = \Drupal::service('openseadragon.config'); - // @todo Once Libraries API is finished find a function for this. - $base_library_path = 'sites/all/assets/vendor'; - // Build the gallery id. $openseadragon_viewer_id = Html::getUniqueId('openseadragon-viewer-iiif-manifest-block'); @@ -115,6 +114,9 @@ function template_preprocess_openseadragon_iiif_manifest_block(&$variables) { // Attach the viewer, using the image urls obtained from the manifest. if (!is_null($iiif_address) && !empty($iiif_address) && !empty($tile_sources)) { + $variables['#attached']['library'] = [ + 'openseadragon/init', + ]; $variables['#attached']['drupalSettings']['openseadragon'][$openseadragon_viewer_id] = [ 'basePath' => Url::fromUri($iiif_address), 'fitToAspectRatio' => $viewer_settings['fit_to_aspect_ratio'], diff --git a/templates/openseadragon-formatter.html.twig b/templates/openseadragon-formatter.html.twig index d25d655..1457be5 100644 --- a/templates/openseadragon-formatter.html.twig +++ b/templates/openseadragon-formatter.html.twig @@ -11,6 +11,4 @@ * @ingroup themeable */ #} -{{ attach_library('libraries/openseadragon') }} -{{ attach_library('openseadragon/init') }}
diff --git a/templates/openseadragon-iiif-manifest-block.html.twig b/templates/openseadragon-iiif-manifest-block.html.twig index b1f31fc..5947c59 100644 --- a/templates/openseadragon-iiif-manifest-block.html.twig +++ b/templates/openseadragon-iiif-manifest-block.html.twig @@ -11,6 +11,4 @@ * @ingroup themeable */ #} -{{ attach_library('libraries/openseadragon') }} -{{ attach_library('openseadragon/init') }}