diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php index d4dc2d5cf18d9301df021688ae640ba503733e3c..fafc4b7fc77545a17190e94d64750a16b32b8952 100644 --- a/module/VuFind/config/module.config.php +++ b/module/VuFind/config/module.config.php @@ -74,16 +74,30 @@ $config = array( ), ), 'controllers' => array( + 'factories' => array( + 'browse' => function ($sm) { + return new \VuFind\Controller\BrowseController( + $sm->getServiceLocator()->get('VuFind\Config')->get('config') + ); + }, + 'collection' => function ($sm) { + return new \VuFind\Controller\CollectionController( + $sm->getServiceLocator()->get('VuFind\Config')->get('config') + ); + }, + 'collections' => function ($sm) { + return new \VuFind\Controller\CollectionsController( + $sm->getServiceLocator()->get('VuFind\Config')->get('config') + ); + }, + ), 'invokables' => array( 'admin' => 'VuFind\Controller\AdminController', 'ajax' => 'VuFind\Controller\AjaxController', 'alphabrowse' => 'VuFind\Controller\AlphabrowseController', 'author' => 'VuFind\Controller\AuthorController', 'authority' => 'VuFind\Controller\AuthorityController', - 'browse' => 'VuFind\Controller\BrowseController', 'cart' => 'VuFind\Controller\CartController', - 'collection' => 'VuFind\Controller\CollectionController', - 'collections' => 'VuFind\Controller\CollectionsController', 'cover' => 'VuFind\Controller\CoverController', 'error' => 'VuFind\Controller\ErrorController', 'help' => 'VuFind\Controller\HelpController', diff --git a/module/VuFind/src/VuFind/Controller/BrowseController.php b/module/VuFind/src/VuFind/Controller/BrowseController.php index 48be553868469c33550c18f7c716e268d8bf2b5d..bffd94c18fa4a0fa3899ba61de164d55d69cb4f9 100644 --- a/module/VuFind/src/VuFind/Controller/BrowseController.php +++ b/module/VuFind/src/VuFind/Controller/BrowseController.php @@ -26,7 +26,6 @@ * @link http://vufind.org/wiki/vufind2:building_a_controller Wiki */ namespace VuFind\Controller; -use VuFind\Config\Reader as ConfigReader; /** * BrowseController Class @@ -64,10 +63,12 @@ class BrowseController extends AbstractBase /** * Constructor + * + * @param \Zend\Config\Config $config VuFind configuration */ - public function __construct() + public function __construct(\Zend\Config\Config $config) { - $this->config = ConfigReader::getConfig(); + $this->config = $config; $this->disabledFacets = array(); foreach ($this->config->Browse as $key => $setting) { diff --git a/module/VuFind/src/VuFind/Controller/CollectionController.php b/module/VuFind/src/VuFind/Controller/CollectionController.php index 380af3f1ed08bbe840ad4528bc44fab33379ee7e..eff46209f5e8c9c9b1348260689389b38585f83c 100644 --- a/module/VuFind/src/VuFind/Controller/CollectionController.php +++ b/module/VuFind/src/VuFind/Controller/CollectionController.php @@ -40,14 +40,15 @@ class CollectionController extends AbstractRecord { /** * Constructor + * + * @param \Zend\Config\Config $config VuFind configuration */ - public function __construct() + public function __construct(\Zend\Config\Config $config) { // Call standard record controller initialization: parent::__construct(); // Set default tab, if specified: - $config = \VuFind\Config\Reader::getConfig(); if (isset($config->Collections->defaultTab)) { $this->defaultTab = $config->Collections->defaultTab; } diff --git a/module/VuFind/src/VuFind/Controller/CollectionsController.php b/module/VuFind/src/VuFind/Controller/CollectionsController.php index 579593815ddd7519d493ed9fe6a38b0088f144df..dd45c58ff60df28cf6d4c3c1dfd32396fbbbbef7 100644 --- a/module/VuFind/src/VuFind/Controller/CollectionsController.php +++ b/module/VuFind/src/VuFind/Controller/CollectionsController.php @@ -47,10 +47,12 @@ class CollectionsController extends AbstractBase /** * Constructor + * + * @param \Zend\Config\Config $config VuFind configuration */ - public function __construct() + public function __construct(\Zend\Config\Config $config) { - $this->config = \VuFind\Config\Reader::getConfig(); + $this->config = $config; } /**