diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php index 5082081ed54222fc66cae15f6469b2ead6e8543c..5ea3f1bacddcb948e0ec6dc0f9780842c842b92e 100644 --- a/module/VuFind/config/module.config.php +++ b/module/VuFind/config/module.config.php @@ -627,6 +627,7 @@ $config = array( 'factories' => array( 'collectionhierarchytree' => function ($sm) { return new \VuFind\RecordTab\CollectionHierarchyTree( + $sm->getServiceLocator()->get('VuFind\Config')->get('config'), $sm->getServiceLocator()->get('VuFind\RecordLoader') ); }, @@ -636,6 +637,11 @@ $config = array( $searchManager->setSearchClassId('SolrCollection')->getResults() ); }, + 'hierarchytree' => function ($sm) { + return new \VuFind\RecordTab\HierarchyTree( + $sm->getServiceLocator()->get('VuFind\Config')->get('config') + ); + }, 'holdingsils' => function ($sm) { // If VuFind is configured to suppress the holdings tab when the // ILS driver specifies no holdings, we need to pass in a connection @@ -654,7 +660,6 @@ $config = array( 'invokables' => array( 'description' => 'VuFind\RecordTab\Description', 'excerpt' => 'VuFind\RecordTab\Excerpt', - 'hierarchytree' => 'VuFind\RecordTab\HierarchyTree', 'holdingsworldcat' => 'VuFind\RecordTab\HoldingsWorldCat', 'map' => 'VuFind\RecordTab\Map', 'reviews' => 'VuFind\RecordTab\Reviews', diff --git a/module/VuFind/src/VuFind/RecordTab/CollectionHierarchyTree.php b/module/VuFind/src/VuFind/RecordTab/CollectionHierarchyTree.php index 6ce6fdb5c80468eaf6a000d19221fa23ff5de45d..493fee2784d70e79a65e96a8f04d2f96b8b487c1 100644 --- a/module/VuFind/src/VuFind/RecordTab/CollectionHierarchyTree.php +++ b/module/VuFind/src/VuFind/RecordTab/CollectionHierarchyTree.php @@ -48,10 +48,13 @@ class CollectionHierarchyTree extends HierarchyTree /** * Constructor * + * @param \Zend\Config\Config $config Configuration * @param \VuFind\Record\Loader $loader Record loader */ - public function __construct(\VuFind\Record\Loader $loader) - { + public function __construct(\Zend\Config\Config $config, + \VuFind\Record\Loader $loader + ) { + parent::__construct($config); $this->loader = $loader; } diff --git a/module/VuFind/src/VuFind/RecordTab/HierarchyTree.php b/module/VuFind/src/VuFind/RecordTab/HierarchyTree.php index dff411f10e7079ef59710ac44303ca63b7d9fda9..00ad966e9989064965496d169b3f67e902db155f 100644 --- a/module/VuFind/src/VuFind/RecordTab/HierarchyTree.php +++ b/module/VuFind/src/VuFind/RecordTab/HierarchyTree.php @@ -26,7 +26,6 @@ * @link http://vufind.org/wiki/vufind2:record_tabs Wiki */ namespace VuFind\RecordTab; -use VuFind\Config\Reader as ConfigReader; /** * HierarchyTree tab @@ -53,6 +52,16 @@ class HierarchyTree extends AbstractBase */ protected $config = null; + /** + * Constructor + * + * @param \Zend\Config\Config $config Configuration + */ + public function __construct(\Zend\Config\Config $config) + { + $this->config = $config; + } + /** * Get the VuFind configuration. * @@ -60,9 +69,6 @@ class HierarchyTree extends AbstractBase */ protected function getConfig() { - if (null === $this->config) { - $this->config = ConfigReader::getConfig(); - } return $this->config; }