diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/IconTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/IconTest.php index c1c77440533..89be1f39a60 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/IconTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/IconTest.php @@ -34,7 +34,7 @@ use Laminas\View\Helper\EscapeHtmlAttr; use VuFind\Escaper\Escaper; use VuFind\View\Helper\Root\Icon; -use VuFindTheme\View\Helper\AssetPipeline; +use VuFindTheme\View\Helper\AssetManager; use VuFindTheme\View\Helper\ImageLink; /** @@ -138,7 +138,7 @@ protected function getIconHelper( ); $plugins = array_merge( [ - 'assetPipeline' => $this->createMock(AssetPipeline::class), + 'assetManager' => $this->createMock(AssetManager::class), 'escapeHtmlAttr' => new EscapeHtmlAttr($escaper), ], $plugins diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/RecordDataFormatterTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/RecordDataFormatterTest.php index a79a4839f42..f2071e9c0b7 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/RecordDataFormatterTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/RecordDataFormatterTest.php @@ -89,7 +89,7 @@ protected function getViewHelpers($container): array }); $record->setDbServiceManager($serviceManager); return [ - 'assetPipeline' => $this->createMock(\VuFindTheme\View\Helper\AssetPipeline::class), + 'assetManager' => $this->createMock(\VuFindTheme\View\Helper\AssetManager::class), 'auth' => new \VuFind\View\Helper\Root\Auth( $this->createMock(\VuFind\Auth\Manager::class), $this->createMock(\VuFind\Auth\ILSAuthenticator::class) diff --git a/module/VuFindTheme/Module.php b/module/VuFindTheme/Module.php index e0e2cd51bad..ac439cc59a5 100644 --- a/module/VuFindTheme/Module.php +++ b/module/VuFindTheme/Module.php @@ -107,7 +107,7 @@ public function getViewHelperConfig() { return [ 'factories' => [ - View\Helper\AssetPipeline::class => View\Helper\AssetPipelineFactory::class, + View\Helper\AssetManager::class => View\Helper\AssetManagerFactory::class, View\Helper\FootScript::class => View\Helper\PipelineInjectorFactory::class, View\Helper\ImageLink::class => View\Helper\ImageLinkFactory::class, View\Helper\HeadScript::class => View\Helper\PipelineInjectorFactory::class, @@ -118,7 +118,7 @@ public function getViewHelperConfig() View\Helper\SetupThemeResources::class => View\Helper\SetupThemeResourcesFactory::class, ], 'aliases' => [ - 'assetPipeline' => View\Helper\AssetPipeline::class, + 'assetManager' => View\Helper\AssetManager::class, 'footScript' => View\Helper\FootScript::class, // Legacy alias for compatibility with pre-8.0 templates: 'headThemeResources' => View\Helper\SetupThemeResources::class, diff --git a/module/VuFindTheme/src/VuFindTheme/View/Helper/AssetPipeline.php b/module/VuFindTheme/src/VuFindTheme/View/Helper/AssetManager.php similarity index 98% rename from module/VuFindTheme/src/VuFindTheme/View/Helper/AssetPipeline.php rename to module/VuFindTheme/src/VuFindTheme/View/Helper/AssetManager.php index 6a8bde6a03a..8fbbc9541ba 100644 --- a/module/VuFindTheme/src/VuFindTheme/View/Helper/AssetPipeline.php +++ b/module/VuFindTheme/src/VuFindTheme/View/Helper/AssetManager.php @@ -1,7 +1,7 @@ getView()->plugin('assetPipeline'); + $assetManager = $this->getView()->plugin('assetManager'); // Load CSS (make sure we prepend them in the appropriate order; theme // resources should load before extras added by individual templates): foreach (array_reverse($this->container->getCss()) as $current) { - $assetPipeline->forcePrependStylesheet( + $assetManager->forcePrependStylesheet( $current['file'], empty($current['media']) ? 'all' : $current['media'], $current['conditional'] ?? '', @@ -171,7 +171,7 @@ protected function addScripts() ); } $this->getView() - ->plugin('assetPipeline') + ->plugin('assetManager') ->forcePrependScriptFile( $current['file'], 'text/javascript', diff --git a/themes/bootstrap5/templates/Helpers/cookie-consent.phtml b/themes/bootstrap5/templates/Helpers/cookie-consent.phtml index 3b784cfae24..54111583db8 100644 --- a/themes/bootstrap5/templates/Helpers/cookie-consent.phtml +++ b/themes/bootstrap5/templates/Helpers/cookie-consent.phtml @@ -1,5 +1,5 @@ assetPipeline()->appendScriptFile('vendor/cookieconsent.umd.js'); +$this->assetManager()->appendScriptFile('vendor/cookieconsent.umd.js'); $configJson = json_encode( [ @@ -7,4 +7,4 @@ $configJson = json_encode( 'controlledVuFindServices' => $this->controlledVuFindServices, ] ); -$this->assetPipeline()->appendScript("window.addEventListener('load', function() { VuFind.cookie.setupConsent($configJson); });"); +$this->assetManager()->appendScript("window.addEventListener('load', function() { VuFind.cookie.setupConsent($configJson); });"); diff --git a/themes/bootstrap5/templates/Recommend/MapSelection.phtml b/themes/bootstrap5/templates/Recommend/MapSelection.phtml index 2310dca3f11..d96a09c11dc 100644 --- a/themes/bootstrap5/templates/Recommend/MapSelection.phtml +++ b/themes/bootstrap5/templates/Recommend/MapSelection.phtml @@ -5,15 +5,15 @@ 'rectangle_center_message' => 'rectangle_center_message', ]); - $this->assetPipeline()->appendScriptFile('vendor/leaflet/leaflet.js'); - $this->assetPipeline()->appendScriptFile('vendor/leaflet/leaflet.draw.js'); - $this->assetPipeline()->appendScriptFile('vendor/leaflet/leaflet.markercluster.js'); - $this->assetPipeline()->appendScriptFile('map_selection_leaflet.js'); - $this->assetPipeline()->appendStylesheet('vendor/leaflet/leaflet.css'); - $this->assetPipeline()->appendStylesheet('vendor/leaflet/leaflet.draw.css'); - $this->assetPipeline()->appendStylesheet('vendor/leaflet/MarkerCluster.css'); - $this->assetPipeline()->appendStylesheet('vendor/leaflet/MarkerCluster.Default.css'); - $this->assetPipeline()->appendStylesheet('geofeatures.css'); + $this->assetManager()->appendScriptFile('vendor/leaflet/leaflet.js'); + $this->assetManager()->appendScriptFile('vendor/leaflet/leaflet.draw.js'); + $this->assetManager()->appendScriptFile('vendor/leaflet/leaflet.markercluster.js'); + $this->assetManager()->appendScriptFile('map_selection_leaflet.js'); + $this->assetManager()->appendStylesheet('vendor/leaflet/leaflet.css'); + $this->assetManager()->appendStylesheet('vendor/leaflet/leaflet.draw.css'); + $this->assetManager()->appendStylesheet('vendor/leaflet/MarkerCluster.css'); + $this->assetManager()->appendStylesheet('vendor/leaflet/MarkerCluster.Default.css'); + $this->assetManager()->appendStylesheet('geofeatures.css'); $basemap = $this->recommend->getBasemap(); $geoField = $this->recommend->getGeoField(); diff --git a/themes/bootstrap5/templates/Recommend/PubDateVisAjax.phtml b/themes/bootstrap5/templates/Recommend/PubDateVisAjax.phtml index 4e46c9ab1b4..9cf630bea99 100644 --- a/themes/bootstrap5/templates/Recommend/PubDateVisAjax.phtml +++ b/themes/bootstrap5/templates/Recommend/PubDateVisAjax.phtml @@ -1,10 +1,10 @@ recommend->getVisFacets()): ?> assetPipeline()->appendScriptFile('vendor/flot/jquery.flot.min.js'); - $this->assetPipeline()->appendScriptFile('vendor/flot/jquery.flot.resize.min.js'); - $this->assetPipeline()->appendScriptFile('vendor/flot/jquery.flot.selection.min.js'); - $this->assetPipeline()->appendScriptFile('pubdate_vis.js'); + $this->assetManager()->appendScriptFile('vendor/flot/jquery.flot.min.js'); + $this->assetManager()->appendScriptFile('vendor/flot/jquery.flot.resize.min.js'); + $this->assetManager()->appendScriptFile('vendor/flot/jquery.flot.selection.min.js'); + $this->assetManager()->appendScriptFile('pubdate_vis.js'); ?> $facetRange): ?>
facet['type'] == 'date'): ?> - assetPipeline()->appendScriptFile('vendor/bootstrap-slider.min.js'); ?> - assetPipeline()->appendStylesheet('vendor/bootstrap-slider.min.css'); ?> + assetManager()->appendScriptFile('vendor/bootstrap-slider.min.js'); ?> + assetManager()->appendStylesheet('vendor/bootstrap-slider.min.css'); ?> layout()->sideFacetsInstanceCounter = ($this->layout()->sideFacetsInstanceCounter ?? 0) + 1; - $this->assetPipeline()->appendScriptFile('facets.js'); + $this->assetManager()->appendScriptFile('facets.js'); $results = $this->recommend->getResults(); $activeFacets = $this->recommend->getActiveFacets(); @@ -22,8 +22,8 @@ foreach ($activeFacets as $field => $facetName) { if (isset($rangeFacets[$field]) && 'date' === $rangeFacets[$field]['type']) { - $this->assetPipeline()->appendScriptFile('vendor/bootstrap-slider.min.js'); - $this->assetPipeline()->appendStylesheet('vendor/bootstrap-slider.min.css'); + $this->assetManager()->appendScriptFile('vendor/bootstrap-slider.min.js'); + $this->assetManager()->appendStylesheet('vendor/bootstrap-slider.min.css'); break; } } diff --git a/themes/bootstrap5/templates/Recommend/VisualFacets.phtml b/themes/bootstrap5/templates/Recommend/VisualFacets.phtml index 99e887b8147..371f7c625b2 100644 --- a/themes/bootstrap5/templates/Recommend/VisualFacets.phtml +++ b/themes/bootstrap5/templates/Recommend/VisualFacets.phtml @@ -1,6 +1,6 @@ assetPipeline()->appendScriptFile('vendor/d3.min.js'); - $this->assetPipeline()->appendScriptFile('visual_facets.js'); + $this->assetManager()->appendScriptFile('vendor/d3.min.js'); + $this->assetManager()->appendScriptFile('visual_facets.js'); $visualFacetSet = $this->recommend->getPivotFacetSet(); diff --git a/themes/bootstrap5/templates/RecordDriver/AbstractBase/previewdata.phtml b/themes/bootstrap5/templates/RecordDriver/AbstractBase/previewdata.phtml index 6a89fc061ec..1cd6af0f6a3 100644 --- a/themes/bootstrap5/templates/RecordDriver/AbstractBase/previewdata.phtml +++ b/themes/bootstrap5/templates/RecordDriver/AbstractBase/previewdata.phtml @@ -78,7 +78,7 @@ // add the necessary identifier code: if (!empty($html)) { $html .= ''; - $this->assetPipeline()->appendScriptFile('preview.js'); + $this->assetManager()->appendScriptFile('preview.js'); echo $html; } } diff --git a/themes/bootstrap5/templates/RecordDriver/DefaultRecord/collection-info.phtml b/themes/bootstrap5/templates/RecordDriver/DefaultRecord/collection-info.phtml index 5cfdf6b2b6a..37a97ab9412 100644 --- a/themes/bootstrap5/templates/RecordDriver/DefaultRecord/collection-info.phtml +++ b/themes/bootstrap5/templates/RecordDriver/DefaultRecord/collection-info.phtml @@ -1,4 +1,4 @@ -assetPipeline()->appendScriptFile('collection_record.js'); ?> +assetManager()->appendScriptFile('collection_record.js'); ?>