From c54cc8f4eafba4b3384a3e2bda22ddb75b4516da Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Fri, 31 Jan 2014 13:37:15 -0500 Subject: [PATCH] Eliminated closures from theme.config.php. --- .../VuFind/View/Helper/Blueprint/Factory.php | 56 +++ .../VuFind/View/Helper/Bootprint/Factory.php | 56 +++ .../VuFind/View/Helper/Bootstrap/Factory.php | 70 +++ .../src/VuFind/View/Helper/Root/Factory.php | 443 ++++++++++++++++++ themes/blueprint/theme.config.php | 7 +- themes/bootprint/theme.config.php | 6 +- themes/bootstrap/theme.config.php | 13 +- themes/root/theme.config.php | 188 ++------ 8 files changed, 658 insertions(+), 181 deletions(-) create mode 100644 module/VuFind/src/VuFind/View/Helper/Blueprint/Factory.php create mode 100644 module/VuFind/src/VuFind/View/Helper/Bootprint/Factory.php create mode 100644 module/VuFind/src/VuFind/View/Helper/Bootstrap/Factory.php create mode 100644 module/VuFind/src/VuFind/View/Helper/Root/Factory.php diff --git a/module/VuFind/src/VuFind/View/Helper/Blueprint/Factory.php b/module/VuFind/src/VuFind/View/Helper/Blueprint/Factory.php new file mode 100644 index 00000000000..9b47daa8e73 --- /dev/null +++ b/module/VuFind/src/VuFind/View/Helper/Blueprint/Factory.php @@ -0,0 +1,56 @@ +<?php +/** + * Factory for Blueprint view helpers. + * + * PHP version 5 + * + * Copyright (C) Villanova University 2014. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @category VuFind2 + * @package View_Helpers + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org/wiki/vufind2:developer_manual Wiki + */ +namespace VuFind\View\Helper\Blueprint; +use Zend\ServiceManager\ServiceManager; + +/** + * Factory for Blueprint view helpers. + * + * @category VuFind2 + * @package View_Helpers + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org/wiki/vufind2:developer_manual Wiki + */ +class Factory +{ + /** + * Construct the LayoutClass helper. + * + * @param ServiceManager $sm Service manager. + * + * @return LayoutClass + */ + public static function getLayoutClass(ServiceManager $sm) + { + $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); + $left = !isset($config->Site->sidebarOnLeft) + ? false : $config->Site->sidebarOnLeft; + return new LayoutClass($left); + } +} \ No newline at end of file diff --git a/module/VuFind/src/VuFind/View/Helper/Bootprint/Factory.php b/module/VuFind/src/VuFind/View/Helper/Bootprint/Factory.php new file mode 100644 index 00000000000..73a2e20c708 --- /dev/null +++ b/module/VuFind/src/VuFind/View/Helper/Bootprint/Factory.php @@ -0,0 +1,56 @@ +<?php +/** + * Factory for Bootprint view helpers. + * + * PHP version 5 + * + * Copyright (C) Villanova University 2014. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @category VuFind2 + * @package View_Helpers + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org/wiki/vufind2:developer_manual Wiki + */ +namespace VuFind\View\Helper\Bootprint; +use Zend\ServiceManager\ServiceManager; + +/** + * Factory for Bootprint view helpers. + * + * @category VuFind2 + * @package View_Helpers + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org/wiki/vufind2:developer_manual Wiki + */ +class Factory +{ + /** + * Construct the LayoutClass helper. + * + * @param ServiceManager $sm Service manager. + * + * @return LayoutClass + */ + public static function getLayoutClass(ServiceManager $sm) + { + $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); + $left = !isset($config->Site->sidebarOnLeft) + ? false : $config->Site->sidebarOnLeft; + return new LayoutClass($left); + } +} \ No newline at end of file diff --git a/module/VuFind/src/VuFind/View/Helper/Bootstrap/Factory.php b/module/VuFind/src/VuFind/View/Helper/Bootstrap/Factory.php new file mode 100644 index 00000000000..f4b76d87f15 --- /dev/null +++ b/module/VuFind/src/VuFind/View/Helper/Bootstrap/Factory.php @@ -0,0 +1,70 @@ +<?php +/** + * Factory for Bootstrap view helpers. + * + * PHP version 5 + * + * Copyright (C) Villanova University 2014. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @category VuFind2 + * @package View_Helpers + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org/wiki/vufind2:developer_manual Wiki + */ +namespace VuFind\View\Helper\Bootstrap; +use Zend\ServiceManager\ServiceManager; + +/** + * Factory for Bootstrap view helpers. + * + * @category VuFind2 + * @package View_Helpers + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org/wiki/vufind2:developer_manual Wiki + */ +class Factory +{ + /** + * Construct the Flashmessages helper. + * + * @param ServiceManager $sm Service manager. + * + * @return Flashmessages + */ + public static function getFlashmessages(ServiceManager $sm) + { + $messenger = $sm->getServiceLocator()->get('ControllerPluginManager') + ->get('FlashMessenger'); + return new Flashmessages($messenger); + } + + /** + * Construct the LayoutClass helper. + * + * @param ServiceManager $sm Service manager. + * + * @return LayoutClass + */ + public static function getLayoutClass(ServiceManager $sm) + { + $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); + $left = !isset($config->Site->sidebarOnLeft) + ? false : $config->Site->sidebarOnLeft; + return new LayoutClass($left); + } +} \ No newline at end of file diff --git a/module/VuFind/src/VuFind/View/Helper/Root/Factory.php b/module/VuFind/src/VuFind/View/Helper/Root/Factory.php new file mode 100644 index 00000000000..5177cc9cbf0 --- /dev/null +++ b/module/VuFind/src/VuFind/View/Helper/Root/Factory.php @@ -0,0 +1,443 @@ +<?php +/** + * Factory for Root view helpers. + * + * PHP version 5 + * + * Copyright (C) Villanova University 2014. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @category VuFind2 + * @package View_Helpers + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org/wiki/vufind2:developer_manual Wiki + */ +namespace VuFind\View\Helper\Root; +use Zend\ServiceManager\ServiceManager; + +/** + * Factory for Root view helpers. + * + * @category VuFind2 + * @package View_Helpers + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org/wiki/vufind2:developer_manual Wiki + */ +class Factory +{ + /** + * Construct the AddThis helper. + * + * @param ServiceManager $sm Service manager. + * + * @return AddThis + */ + public static function getAddThis(ServiceManager $sm) + { + $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); + return new AddThis( + isset($config->AddThis->key) ? $config->AddThis->key : false + ); + } + + /** + * Construct the Auth helper. + * + * @param ServiceManager $sm Service manager. + * + * @return Auth + */ + public static function getAuth(ServiceManager $sm) + { + return new Auth($sm->getServiceLocator()->get('VuFind\AuthManager')); + } + + /** + * Construct the AuthorNotes helper. + * + * @param ServiceManager $sm Service manager. + * + * @return AuthorNotes + */ + public static function getAuthorNotes(ServiceManager $sm) + { + return new AuthorNotes( + $sm->getServiceLocator()->get('VuFind\Config')->get('config') + ); + } + + /** + * Construct the Cart helper. + * + * @param ServiceManager $sm Service manager. + * + * @return Cart + */ + public static function getCart(ServiceManager $sm) + { + return new Cart($sm->getServiceLocator()->get('VuFind\Cart')); + } + + /** + * Construct the Citation helper. + * + * @param ServiceManager $sm Service manager. + * + * @return Citation + */ + public static function getCitation(ServiceManager $sm) + { + return new Citation($sm->getServiceLocator()->get('VuFind\DateConverter')); + } + + /** + * Construct the DateTime helper. + * + * @param ServiceManager $sm Service manager. + * + * @return DateTime + */ + public static function getDateTime(ServiceManager $sm) + { + return new DateTime($sm->getServiceLocator()->get('VuFind\DateConverter')); + } + + /** + * Construct the DisplayLanguageOption helper. + * + * @param ServiceManager $sm Service manager. + * + * @return DisplayLanguageOption + */ + public static function getDisplayLanguageOption(ServiceManager $sm) + { + return new DisplayLanguageOption( + $sm->getServiceLocator()->get('VuFind\Translator') + ); + } + + /** + * Construct the Excerpt helper. + * + * @param ServiceManager $sm Service manager. + * + * @return Excerpt + */ + public static function getExcerpt(ServiceManager $sm) + { + return new Excerpt( + $sm->getServiceLocator()->get('VuFind\Config')->get('config') + ); + } + + /** + * Construct the Export helper. + * + * @param ServiceManager $sm Service manager. + * + * @return Export + */ + public static function getExport(ServiceManager $sm) + { + return new Export($sm->getServiceLocator()->get('VuFind\Export')); + } + + /** + * Construct the Feedback helper. + * + * @param ServiceManager $sm Service manager. + * + * @return Feedback + */ + public static function getFeedback(ServiceManager $sm) + { + $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); + $enabled = isset($config->Feedback->tab_enabled) + ? $config->Feedback->tab_enabled : false; + return new Feedback($enabled); + } + + /** + * Construct the Flashmessages helper. + * + * @param ServiceManager $sm Service manager. + * + * @return Flashmessages + */ + public static function getFlashmessages(ServiceManager $sm) + { + $messenger = $sm->getServiceLocator()->get('ControllerPluginManager') + ->get('FlashMessenger'); + return new Flashmessages($messenger); + } + + /** + * Construct the GoogleAnalytics helper. + * + * @param ServiceManager $sm Service manager. + * + * @return GoogleAnalytics + */ + public static function getGoogleAnalytics(ServiceManager $sm) + { + $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); + $key = isset($config->GoogleAnalytics->apiKey) + ? $config->GoogleAnalytics->apiKey : false; + return new GoogleAnalytics($key); + } + + /** + * Construct the GetLastSearchLink helper. + * + * @param ServiceManager $sm Service manager. + * + * @return GetLastSearchLink + */ + public static function getGetLastSearchLink(ServiceManager $sm) + { + return new GetLastSearchLink( + $sm->getServiceLocator()->get('VuFind\Search\Memory') + ); + } + + /** + * Construct the HistoryLabel helper. + * + * @param ServiceManager $sm Service manager. + * + * @return HistoryLabel + */ + public static function getHistoryLabel(ServiceManager $sm) + { + $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); + $config = isset($config->SearchHistoryLabels) + ? $config->SearchHistoryLabels->toArray() : array(); + return new HistoryLabel($config, $sm->get('transesc')); + } + + /** + * Construct the Ils helper. + * + * @param ServiceManager $sm Service manager. + * + * @return Ils + */ + public static function getIls(ServiceManager $sm) + { + return new Ils($sm->getServiceLocator()->get('VuFind\ILSConnection')); + } + + /** + * Construct the JsTranslations helper. + * + * @param ServiceManager $sm Service manager. + * + * @return JsTranslations + */ + public static function getJsTranslations(ServiceManager $sm) + { + return new JsTranslations($sm->get('transesc')); + } + + /** + * Construct the ProxyUrl helper. + * + * @param ServiceManager $sm Service manager. + * + * @return ProxyUrl + */ + public static function getProxyUrl(ServiceManager $sm) + { + return new ProxyUrl( + $sm->getServiceLocator()->get('VuFind\Config')->get('config') + ); + } + + /** + * Construct the OpenUrl helper. + * + * @param ServiceManager $sm Service manager. + * + * @return OpenUrl + */ + public static function getOpenUrl(ServiceManager $sm) + { + $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); + return new OpenUrl( + $sm->get('context'), isset($config->OpenURL) ? $config->OpenURL : null + ); + } + + /** + * Construct the Record helper. + * + * @param ServiceManager $sm Service manager. + * + * @return Record + */ + public static function getRecord(ServiceManager $sm) + { + return new Record( + $sm->getServiceLocator()->get('VuFind\Config')->get('config') + ); + } + + /** + * Construct the RecordLink helper. + * + * @param ServiceManager $sm Service manager. + * + * @return RecordLink + */ + public static function getRecordLink(ServiceManager $sm) + { + return new RecordLink($sm->getServiceLocator()->get('VuFind\RecordRouter')); + } + + /** + * Construct the Related helper. + * + * @param ServiceManager $sm Service manager. + * + * @return Related + */ + public static function getRelated(ServiceManager $sm) + { + return new Related( + $sm->getServiceLocator()->get('VuFind\RelatedPluginManager') + ); + } + + /** + * Construct the Reviews helper. + * + * @param ServiceManager $sm Service manager. + * + * @return Reviews + */ + public static function getReviews(ServiceManager $sm) + { + return new Reviews( + $sm->getServiceLocator()->get('VuFind\Config')->get('config') + ); + } + + /** + * Construct the SearchBox helper. + * + * @param ServiceManager $sm Service manager. + * + * @return SearchBox + */ + public static function getSearchBox(ServiceManager $sm) + { + $config = $sm->getServiceLocator()->get('VuFind\Config'); + return new SearchBox( + $sm->getServiceLocator()->get('VuFind\SearchOptionsPluginManager'), + $config->get('searchbox')->toArray() + ); + } + + /** + * Construct the SearchOptions helper. + * + * @param ServiceManager $sm Service manager. + * + * @return SearchOptions + */ + public static function getSearchOptions(ServiceManager $sm) + { + return new SearchOptions( + $sm->getServiceLocator()->get('VuFind\SearchOptionsPluginManager') + ); + } + + /** + * Construct the SearchTabs helper. + * + * @param ServiceManager $sm Service manager. + * + * @return SearchTabs + */ + public static function getSearchTabs(ServiceManager $sm) + { + $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); + $config = isset($config->SearchTabs) + ? $config->SearchTabs->toArray() : array(); + return new SearchTabs( + $sm->getServiceLocator()->get('VuFind\SearchResultsPluginManager'), + $config, $sm->get('url') + ); + } + + /** + * Construct the SyndeticsPlus helper. + * + * @param ServiceManager $sm Service manager. + * + * @return SyndeticsPlus + */ + public static function getSyndeticsPlus(ServiceManager $sm) + { + $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); + return new SyndeticsPlus( + isset($config->Syndetics) ? $config->Syndetics : null + ); + } + + /** + * Construct the SystemEmail helper. + * + * @param ServiceManager $sm Service manager. + * + * @return SystemEmail + */ + public static function getSystemEmail(ServiceManager $sm) + { + $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); + return new SystemEmail( + isset($config->Site->email) ? $config->Site->email : '' + ); + } + + /** + * Construct the VideoClips helper. + * + * @param ServiceManager $sm Service manager. + * + * @return VideoClips + */ + public static function getVideoClips(ServiceManager $sm) + { + return new VideoClips( + $sm->getServiceLocator()->get('VuFind\Config')->get('config') + ); + } + + /** + * Construct the WorldCat helper. + * + * @param ServiceManager $sm Service manager. + * + * @return WorldCat + */ + public static function getWorldCat(ServiceManager $sm) + { + $bm = $sm->getServiceLocator()->get('VuFind\Search\BackendManager'); + return new WorldCat($bm->get('WorldCat')->getConnector()); + } +} \ No newline at end of file diff --git a/themes/blueprint/theme.config.php b/themes/blueprint/theme.config.php index 98dd7a4b446..2a586ff0668 100644 --- a/themes/blueprint/theme.config.php +++ b/themes/blueprint/theme.config.php @@ -22,12 +22,7 @@ return array( 'favicon' => 'vufind-favicon.ico', 'helpers' => array( 'factories' => array( - 'layoutclass' => function ($sm) { - $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); - $left = !isset($config->Site->sidebarOnLeft) - ? false : $config->Site->sidebarOnLeft; - return new \VuFind\View\Helper\Blueprint\LayoutClass($left); - }, + 'layoutclass' => array('VuFind\View\Helper\Blueprint\Factory', 'getLayoutClass'), ), 'invokables' => array( 'search' => 'VuFind\View\Helper\Blueprint\Search', diff --git a/themes/bootprint/theme.config.php b/themes/bootprint/theme.config.php index 741d81a175f..1a699363705 100644 --- a/themes/bootprint/theme.config.php +++ b/themes/bootprint/theme.config.php @@ -7,11 +7,7 @@ return array( ), 'helpers' => array( 'factories' => array( - 'layoutclass' => function ($sm) { - $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); - $left = !isset($config->Site->sidebarOnLeft) ? false : $config->Site->sidebarOnLeft; - return new \VuFind\View\Helper\Bootprint\LayoutClass($left); - } + 'layoutclass' => array('VuFind\View\Helper\Bootprint\Factory', 'getLayoutClass'), ) ) ); diff --git a/themes/bootstrap/theme.config.php b/themes/bootstrap/theme.config.php index 178671510f1..b4d6fdfde0d 100644 --- a/themes/bootstrap/theme.config.php +++ b/themes/bootstrap/theme.config.php @@ -20,17 +20,8 @@ return array( 'favicon' => 'vufind-favicon.ico', 'helpers' => array( 'factories' => array( - 'flashmessages' => function ($sm) { - $messenger = $sm->getServiceLocator()->get('ControllerPluginManager') - ->get('FlashMessenger'); - return new \VuFind\View\Helper\Bootstrap\Flashmessages($messenger); - }, - 'layoutclass' => function ($sm) { - $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); - $left = !isset($config->Site->sidebarOnLeft) - ? false : $config->Site->sidebarOnLeft; - return new \VuFind\View\Helper\Bootstrap\LayoutClass($left); - }, + 'flashmessages' => array('VuFind\View\Helper\Bootstrap\Factory', 'getFlashmessages'), + 'layoutclass' => array('VuFind\View\Helper\Bootstrap\Factory', 'getLayoutClass'), ), 'invokables' => array( 'highlight' => 'VuFind\View\Helper\Bootstrap\Highlight', diff --git a/themes/root/theme.config.php b/themes/root/theme.config.php index 1eec7dea6b0..5f262992126 100644 --- a/themes/root/theme.config.php +++ b/themes/root/theme.config.php @@ -3,165 +3,35 @@ return array( 'extends' => false, 'helpers' => array( 'factories' => array( - 'addthis' => function ($sm) { - $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); - return new \VuFind\View\Helper\Root\AddThis( - isset($config->AddThis->key) ? $config->AddThis->key : false - ); - }, - 'auth' => function ($sm) { - return new \VuFind\View\Helper\Root\Auth( - $sm->getServiceLocator()->get('VuFind\AuthManager') - ); - }, - 'authornotes' => function ($sm) { - return new \VuFind\View\Helper\Root\AuthorNotes( - $sm->getServiceLocator()->get('VuFind\Config')->get('config') - ); - }, - 'cart' => function ($sm) { - return new \VuFind\View\Helper\Root\Cart( - $sm->getServiceLocator()->get('VuFind\Cart') - ); - }, - 'citation' => function ($sm) { - return new \VuFind\View\Helper\Root\Citation( - $sm->getServiceLocator()->get('VuFind\DateConverter') - ); - }, - 'datetime' => function ($sm) { - return new \VuFind\View\Helper\Root\DateTime( - $sm->getServiceLocator()->get('VuFind\DateConverter') - ); - }, - 'displaylanguageoption' => function ($sm) { - return new VuFind\View\Helper\Root\DisplayLanguageOption( - $sm->getServiceLocator()->get('VuFind\Translator') - ); - }, - 'excerpt' => function ($sm) { - return new \VuFind\View\Helper\Root\Excerpt( - $sm->getServiceLocator()->get('VuFind\Config')->get('config') - ); - }, - 'export' => function ($sm) { - return new \VuFind\View\Helper\Root\Export( - $sm->getServiceLocator()->get('VuFind\Export') - ); - }, - 'feedback' => function ($sm) { - $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); - $enabled = isset($config->Feedback->tab_enabled) - ? $config->Feedback->tab_enabled : false; - return new \VuFind\View\Helper\Root\Feedback($enabled); - }, - 'flashmessages' => function ($sm) { - $messenger = $sm->getServiceLocator()->get('ControllerPluginManager') - ->get('FlashMessenger'); - return new \VuFind\View\Helper\Root\Flashmessages($messenger); - }, - 'googleanalytics' => function ($sm) { - $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); - $key = isset($config->GoogleAnalytics->apiKey) - ? $config->GoogleAnalytics->apiKey : false; - return new \VuFind\View\Helper\Root\GoogleAnalytics($key); - }, - 'getlastsearchlink' => function ($sm) { - return new \VuFind\View\Helper\Root\GetLastSearchLink( - $sm->getServiceLocator()->get('VuFind\Search\Memory') - ); - }, - 'historylabel' => function ($sm) { - $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); - $config = isset($config->SearchHistoryLabels) - ? $config->SearchHistoryLabels->toArray() : array(); - return new VuFind\View\Helper\Root\HistoryLabel( - $config, $sm->get('transesc') - ); - }, - 'ils' => function ($sm) { - return new \VuFind\View\Helper\Root\Ils( - $sm->getServiceLocator()->get('VuFind\ILSConnection') - ); - }, - 'jstranslations' => function($sm) { - return new \VuFind\View\Helper\Root\JsTranslations($sm->get('transesc')); - }, - 'proxyurl' => function ($sm) { - return new \VuFind\View\Helper\Root\ProxyUrl( - $sm->getServiceLocator()->get('VuFind\Config')->get('config') - ); - }, - 'openurl' => function ($sm) { - $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); - return new \VuFind\View\Helper\Root\OpenUrl( - $sm->get('context'), - isset($config->OpenURL) ? $config->OpenURL : null - ); - }, - 'record' => function ($sm) { - return new \VuFind\View\Helper\Root\Record( - $sm->getServiceLocator()->get('VuFind\Config')->get('config') - ); - }, - 'recordlink' => function ($sm) { - return new \VuFind\View\Helper\Root\RecordLink( - $sm->getServiceLocator()->get('VuFind\RecordRouter') - ); - }, - 'related' => function ($sm) { - return new \VuFind\View\Helper\Root\Related( - $sm->getServiceLocator()->get('VuFind\RelatedPluginManager') - ); - }, - 'reviews' => function ($sm) { - return new \VuFind\View\Helper\Root\Reviews( - $sm->getServiceLocator()->get('VuFind\Config')->get('config') - ); - }, - 'searchbox' => function ($sm) { - $config = $sm->getServiceLocator()->get('VuFind\Config')->get('searchbox')->toArray(); - return new \VuFind\View\Helper\Root\SearchBox( - $sm->getServiceLocator()->get('VuFind\SearchOptionsPluginManager'), - $config - ); - }, - 'searchoptions' => function ($sm) { - return new VuFind\View\Helper\Root\SearchOptions( - $sm->getServiceLocator()->get('VuFind\SearchOptionsPluginManager') - ); - }, - 'searchtabs' => function ($sm) { - $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); - $config = isset($config->SearchTabs) - ? $config->SearchTabs->toArray() : array(); - return new VuFind\View\Helper\Root\SearchTabs( - $sm->getServiceLocator()->get('VuFind\SearchResultsPluginManager'), - $config, $sm->get('url') - ); - }, - 'syndeticsplus' => function ($sm) { - $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); - return new \VuFind\View\Helper\Root\SyndeticsPlus( - isset($config->Syndetics) ? $config->Syndetics : null - ); - }, - 'systememail' => function ($sm) { - $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config'); - return new \VuFind\View\Helper\Root\SystemEmail( - isset($config->Site->email) ? $config->Site->email : '' - ); - }, - 'videoclips' => function ($sm) { - return new \VuFind\View\Helper\Root\VideoClips( - $sm->getServiceLocator()->get('VuFind\Config')->get('config') - ); - }, - 'worldcat' => function ($sm) { - return new \VuFind\View\Helper\Root\WorldCat( - $sm->getServiceLocator()->get('VuFind\Search\BackendManager')->get('WorldCat')->getConnector() - ); - } + 'addthis' => array('VuFind\View\Helper\Root\Factory', 'getAddThis'), + 'auth' => array('VuFind\View\Helper\Root\Factory', 'getAuth'), + 'authornotes' => array('VuFind\View\Helper\Root\Factory', 'getAuthorNotes'), + 'cart' => array('VuFind\View\Helper\Root\Factory', 'getCart'), + 'citation' => array('VuFind\View\Helper\Root\Factory', 'getCitation'), + 'datetime' => array('VuFind\View\Helper\Root\Factory', 'getDateTime'), + 'displaylanguageoption' => array('VuFind\View\Helper\Root\Factory', 'getDisplayLanguageOption'), + 'excerpt' => array('VuFind\View\Helper\Root\Factory', 'getExcerpt'), + 'export' => array('VuFind\View\Helper\Root\Factory', 'getExport'), + 'feedback' => array('VuFind\View\Helper\Root\Factory', 'getFeedback'), + 'flashmessages' => array('VuFind\View\Helper\Root\Factory', 'getFlashmessages'), + 'googleanalytics' => array('VuFind\View\Helper\Root\Factory', 'getGoogleAnalytics'), + 'getlastsearchlink' => array('VuFind\View\Helper\Root\Factory', 'getGetLastSearchLink'), + 'historylabel' => array('VuFind\View\Helper\Root\Factory', 'getHistoryLabel'), + 'ils' => array('VuFind\View\Helper\Root\Factory', 'getIls'), + 'jstranslations' => array('VuFind\View\Helper\Root\Factory', 'getJsTranslations'), + 'proxyurl' => array('VuFind\View\Helper\Root\Factory', 'getProxyUrl'), + 'openurl' => array('VuFind\View\Helper\Root\Factory', 'getOpenUrl'), + 'record' => array('VuFind\View\Helper\Root\Factory', 'getRecord'), + 'recordlink' => array('VuFind\View\Helper\Root\Factory', 'getRecordLink'), + 'related' => array('VuFind\View\Helper\Root\Factory', 'getRelated'), + 'reviews' => array('VuFind\View\Helper\Root\Factory', 'getReviews'), + 'searchbox' => array('VuFind\View\Helper\Root\Factory', 'getSearchBox'), + 'searchoptions' => array('VuFind\View\Helper\Root\Factory', 'getSearchOptions'), + 'searchtabs' => array('VuFind\View\Helper\Root\Factory', 'getSearchTabs'), + 'syndeticsplus' => array('VuFind\View\Helper\Root\Factory', 'getSyndeticsPlus'), + 'systememail' => array('VuFind\View\Helper\Root\Factory', 'getSystemEmail'), + 'videoclips' => array('VuFind\View\Helper\Root\Factory', 'getVideoClips'), + 'worldcat' => array('VuFind\View\Helper\Root\Factory', 'getWorldCat'), ), 'invokables' => array( 'addellipsis' => 'VuFind\View\Helper\Root\AddEllipsis', -- GitLab