Skip to content

Commit

Permalink
Rename helper from assetPipeline to assetManager.
Browse files Browse the repository at this point in the history
  • Loading branch information
demiankatz committed Feb 3, 2025
1 parent 4a5ab46 commit d34081d
Show file tree
Hide file tree
Showing 50 changed files with 115 additions and 115 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions module/VuFindTheme/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Asset pipeline view helper
* Asset manager view helper (for pre-processing, combining when appropriate, etc.)
*
* PHP version 8
*
Expand Down Expand Up @@ -41,15 +41,15 @@
use function is_resource;

/**
* Asset pipeline view helper.
* Asset manager view helper (for pre-processing, combining when appropriate, etc.)
*
* @category VuFind
* @package View_Helpers
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development Wiki
*/
class AssetPipeline extends \Laminas\View\Helper\AbstractHelper implements LoggerAwareInterface
class AssetManager extends \Laminas\View\Helper\AbstractHelper implements LoggerAwareInterface
{
use LoggerAwareTrait;
use RelativePathTrait;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Factory for AssetPipeline view helper.
* Factory for AssetManager view helper.
*
* PHP version 8
*
Expand Down Expand Up @@ -38,15 +38,15 @@
use function count;

/**
* Factory for AssetPipeline view helper.
* Factory for AssetManager view helper.
*
* @category VuFind
* @package Theme
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org Main Site
*/
class AssetPipelineFactory implements FactoryInterface
class AssetManagerFactory implements FactoryInterface
{
/**
* Split config and return prefixed setting with current environment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ protected function addMetaTags()
protected function addLinks(bool $partial = false)
{
// Convenient shortcut to view helper:
$assetPipeline = $this->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'] ?? '',
Expand Down Expand Up @@ -171,7 +171,7 @@ protected function addScripts()
);
}
$this->getView()
->plugin('assetPipeline')
->plugin('assetManager')
->forcePrependScriptFile(
$current['file'],
'text/javascript',
Expand Down
4 changes: 2 additions & 2 deletions themes/bootstrap5/templates/Helpers/cookie-consent.phtml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
$this->assetPipeline()->appendScriptFile('vendor/cookieconsent.umd.js');
$this->assetManager()->appendScriptFile('vendor/cookieconsent.umd.js');

$configJson = json_encode(
[
'consentDialog' => $this->consentDialogConfig,
'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); });");
18 changes: 9 additions & 9 deletions themes/bootstrap5/templates/Recommend/MapSelection.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions themes/bootstrap5/templates/Recommend/PubDateVisAjax.phtml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php if ($visFacets = $this->recommend->getVisFacets()): ?>
<?php
// load jQuery flot:
$this->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');
?>
<?php foreach ($visFacets as $facetField => $facetRange): ?>
<div class="authorbox">
Expand Down
2 changes: 1 addition & 1 deletion themes/bootstrap5/templates/Recommend/SideFacets.phtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$this->layout()->sideFacetsInstanceCounter = ($this->layout()->sideFacetsInstanceCounter ?? 0) + 1;
$this->assetPipeline()->appendScriptFile('facets.js');
$this->assetManager()->appendScriptFile('facets.js');

// Save results/options to $this so they are available to sub-templates:
$this->results = $results = $this->recommend->getResults();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
</form>
</div>
<?php if ($this->facet['type'] == 'date'): ?>
<?php $this->assetPipeline()->appendScriptFile('vendor/bootstrap-slider.min.js'); ?>
<?php $this->assetPipeline()->appendStylesheet('vendor/bootstrap-slider.min.css'); ?>
<?php $this->assetManager()->appendScriptFile('vendor/bootstrap-slider.min.js'); ?>
<?php $this->assetManager()->appendStylesheet('vendor/bootstrap-slider.min.css'); ?>
<?php
$min = !empty($cleanValues[0]) ? min($cleanValues[0], 1400) : 1400;
$future = date('Y', time() + 31536000); // next year
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$this->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();
Expand All @@ -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;
}
}
Expand Down
4 changes: 2 additions & 2 deletions themes/bootstrap5/templates/Recommend/VisualFacets.phtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$this->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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
// add the necessary identifier code:
if (!empty($html)) {
$html .= '<span class="previewBibkeys ' . $idClasses . '"></span>';
$this->assetPipeline()->appendScriptFile('preview.js');
$this->assetManager()->appendScriptFile('preview.js');
echo $html;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php $this->assetPipeline()->appendScriptFile('collection_record.js'); ?>
<?php $this->assetManager()->appendScriptFile('collection_record.js'); ?>
<div class="media">
<?php
$QRCode = $this->record($this->driver)->getQRCode('core');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$this->assetPipeline()->appendScriptFile('vendor/chart.js');
$this->assetPipeline()->appendScriptFile('explain.js');
$this->assetManager()->appendScriptFile('vendor/chart.js');
$this->assetManager()->appendScriptFile('explain.js');

$explanation = $this->explanation;
$recordId = $explanation->getRecordId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
?>
<?php if (!empty($this->request) && $score && $maxScore !== null && $maxScore > 0):?>
<?php
$this->assetPipeline()->appendScriptFile('vendor/chart.js');
$this->assetPipeline()->appendScriptFile('explain.js');
$this->assetManager()->appendScriptFile('vendor/chart.js');
$this->assetManager()->appendScriptFile('explain.js');
$link = $this->recordLinker()->getActionUrl($this->driver, 'Explain', $this->request);
?>
<a class="result-list-explain" target="_blank" href="<?=$this->escapeHtmlAttr($link)?>">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
$addThis = $this->addThis();
if (!empty($addThis)) {
$this->assetPipeline()->appendScriptFile('https://s7.addthis.com/js/250/addthis_widget.js?pub=' . urlencode($addThis));
$this->assetManager()->appendScriptFile('https://s7.addthis.com/js/250/addthis_widget.js?pub=' . urlencode($addThis));
}
?>
<nav class="record-nav" aria-label="<?=$this->transEscAttr('ajaxview_label_tools'); ?>">
Expand Down
2 changes: 1 addition & 1 deletion themes/bootstrap5/templates/RecordDriver/EDS/core.phtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php $this->assetPipeline()->appendStylesheet('EDS.css'); ?>
<?php $this->assetManager()->appendStylesheet('EDS.css'); ?>
<?php
$items = $this->driver->getItems('core');
$dbLabel = $this->driver->getDbLabel();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$this->assetPipeline()->appendStylesheet('EDS.css');
$this->assetManager()->appendStylesheet('EDS.css');
$accessLevel = $this->driver->getAccessLevel();
$restrictedView = empty($accessLevel) ? false : true;
$recordLinker = $this->recordLinker($this->results);
Expand Down
2 changes: 1 addition & 1 deletion themes/bootstrap5/templates/RecordDriver/EPF/core.phtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php $this->assetPipeline()->appendStylesheet('EDS.css'); ?>
<?php $this->assetManager()->appendStylesheet('EDS.css'); ?>
<?php
$items = $this->driver->getItems('core');
$accessLevel = $this->driver->getAccessLevel();
Expand Down
8 changes: 4 additions & 4 deletions themes/bootstrap5/templates/RecordTab/map.phtml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
$this->assetPipeline()->appendScriptFile('vendor/leaflet/leaflet.js');
$this->assetPipeline()->appendScriptFile('vendor/leaflet/leaflet.latlng-graticule.js');
$this->assetPipeline()->appendScriptFile('map_tab_leaflet.js');
$this->assetPipeline()->appendStylesheet('vendor/leaflet/leaflet.css');
$this->assetManager()->appendScriptFile('vendor/leaflet/leaflet.js');
$this->assetManager()->appendScriptFile('vendor/leaflet/leaflet.latlng-graticule.js');
$this->assetManager()->appendScriptFile('map_tab_leaflet.js');
$this->assetManager()->appendStylesheet('vendor/leaflet/leaflet.css');
$this->jsTranslations()->addStrings(
['Coordinates' => 'Coordinates', 'no_description' => 'no_description']
);
Expand Down
4 changes: 2 additions & 2 deletions themes/bootstrap5/templates/RecordTab/preview.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$this->headTitle($this->translate('Preview') . ': ' . $this->driver->getBreadcrumb());

// load the embedded preview javascript file
$this->assetPipeline()->appendScriptFile('https://www.google.com/books/jsapi.js');
$this->assetPipeline()->appendScriptFile('embedGBS.js');
$this->assetManager()->appendScriptFile('https://www.google.com/books/jsapi.js');
$this->assetManager()->appendScriptFile('embedGBS.js');
?>
<div id="gbsViewer" style="height: 600px;"></div>
8 changes: 4 additions & 4 deletions themes/bootstrap5/templates/channels/channelList.phtml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
$this->assetPipeline()->appendStylesheet('vendor/slick.css');
$this->assetPipeline()->appendStylesheet('vendor/slick-theme.css');
$this->assetPipeline()->appendScriptFile('vendor/slick.min.js');
$this->assetPipeline()->appendScriptFile('channels.js');
$this->assetManager()->appendStylesheet('vendor/slick.css');
$this->assetManager()->appendStylesheet('vendor/slick-theme.css');
$this->assetManager()->appendScriptFile('vendor/slick.min.js');
$this->assetManager()->appendScriptFile('channels.js');
$this->jsTranslations()->addStrings([
'channel_browse' => 'channel_browse',
'channel_expand' => 'channel_expand',
Expand Down
2 changes: 1 addition & 1 deletion themes/bootstrap5/templates/checkouts/history.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Set up breadcrumbs:
$this->layout()->breadcrumbs = '<li><a href="' . $this->url('myresearch-home') . '">' . $this->transEsc('Your Account') . '</a></li> <li class="active">' . $this->transEsc('Loan History') . '</li>';

$this->assetPipeline()->appendScriptFile('checkouts.js');
$this->assetManager()->appendScriptFile('checkouts.js');
?>

<?=$this->component('show-account-menu-button')?>
Expand Down
8 changes: 4 additions & 4 deletions themes/bootstrap5/templates/collection/view.phtml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php
// Set up standard record scripts:
$this->assetPipeline()->appendScriptFile('record.js');
$this->assetPipeline()->appendScriptFile('check_save_statuses.js');
$this->assetManager()->appendScriptFile('record.js');
$this->assetManager()->appendScriptFile('check_save_statuses.js');
// Activate Syndetics Plus if necessary:
if ($this->syndeticsPlus()->isActive()) {
$this->assetPipeline()->appendScriptFile($this->syndeticsPlus()->getScript());
$this->assetManager()->appendScriptFile($this->syndeticsPlus()->getScript());
}
// Add any extra scripts the tabs require:
foreach ($this->tabsExtraScripts as $script) {
$this->assetPipeline()->appendScriptFile($script);
$this->assetManager()->appendScriptFile($script);
}

// Add RDF header link if applicable:
Expand Down
4 changes: 2 additions & 2 deletions themes/bootstrap5/templates/combined/results.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@

// Load Javascript dependencies into header:
$this->render('search/results-scripts.phtml', compact('displayVersions'));
$this->assetPipeline()->appendScriptFile('combined-search.js');
$this->assetManager()->appendScriptFile('combined-search.js');
// Style
$this->assetPipeline()->appendStylesheet('combined-search.css');
$this->assetManager()->appendStylesheet('combined-search.css');
?>
<?=$this->flashmessages()?>
<h1 class="sr-only"><?=$this->escapeHtml($headTitle)?></h1>
Expand Down
2 changes: 1 addition & 1 deletion themes/bootstrap5/templates/holds/list.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Set up breadcrumbs:
$this->layout()->breadcrumbs = '<li><a href="' . $this->url('myresearch-home') . '">' . $this->transEsc('Your Account') . '</a></li> <li class="active">' . $this->transEsc('My Holds') . '</li>';

$this->assetPipeline()->appendScriptFile('requests.js');
$this->assetManager()->appendScriptFile('requests.js');
?>

<?=$this->component('show-account-menu-button')?>
Expand Down
2 changes: 1 addition & 1 deletion themes/bootstrap5/templates/install/showsql.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
$this->layout()->breadcrumbs = '<li class="active">' . $this->transEsc('Install VuFind') . '</li>';

// Set up styles:
$this->assetPipeline()->appendStyle(
$this->assetManager()->appendStyle(
".pre {\n"
. " white-space:pre-wrap; width:90%; overflow-y:visible; padding:8px; margin:1em 2em; background:#EEE; border:1px dashed #CCC;\n"
. "}\n"
Expand Down
Loading

0 comments on commit d34081d

Please sign in to comment.