diff --git a/module/finc/config/module.config.php b/module/finc/config/module.config.php index ecf42016f54dc70d5771fe8c0667493b58d1c9d4..401440dc5d3a359c44d3430868fd3fbff2128119 100644 --- a/module/finc/config/module.config.php +++ b/module/finc/config/module.config.php @@ -155,7 +155,7 @@ $config = [ 'finc\RecordTab\AcquisitionPDA' => 'Zend\ServiceManager\Factory\InvokableFactory', 'finc\RecordTab\Topics' => 'Zend\ServiceManager\Factory\InvokableFactory', 'finc\RecordTab\DescriptionLido' => 'Zend\ServiceManager\Factory\InvokableFactory', - 'finc\RecordTab\HierarchyTree' => 'VuFind\RecordTab\Factory::getHierarchyTree', + 'finc\RecordTab\HierarchyTree' => 'finc\RecordTab\HierarchyTreeFactory', ], 'aliases' => [ 'VuFind\RecordTab\HierarchyTree' => 'finc\RecordTab\HierarchyTree', diff --git a/module/finc/src/finc/RecordTab/HierarchyTree.php b/module/finc/src/finc/RecordTab/HierarchyTree.php index 1c6eb81bf947106e5e0621c3f4f0f9be5b0860b3..cfc6a02c43cc86cde7eb86e3cc1a79e0bcab68a3 100644 --- a/module/finc/src/finc/RecordTab/HierarchyTree.php +++ b/module/finc/src/finc/RecordTab/HierarchyTree.php @@ -45,23 +45,6 @@ class HierarchyTree extends \VuFind\RecordTab\HierarchyTree */ protected $treeList = null; - /** - * Configuration - * - * @var \Zend\Config\Config - */ - protected $config = null; - - /** - * Constructor - * - * @param \Zend\Config\Config $config Configuration - */ - public function __construct(\Zend\Config\Config $config) - { - $this->config = $config; - } - public function getDescription() { if ($this->driver->isCollection()) return 'collection_hierarchy_tree_tab'; diff --git a/module/finc/src/finc/RecordTab/HierarchyTreeFactory.php b/module/finc/src/finc/RecordTab/HierarchyTreeFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..7c2b1c7672f2964a0a503da611a91fbc9c3c478d --- /dev/null +++ b/module/finc/src/finc/RecordTab/HierarchyTreeFactory.php @@ -0,0 +1,63 @@ +<?php +/** + * Record Tab Invokable Factory Class + * for HierarchyTree tab + * + * PHP version 7 + * + * Copyright (C) Leipzig University Library, 2020. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category VuFind + * @package RecordTab + * @author Dorian Merz <merz@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development:plugins:hierarchy_components Wiki + */ +namespace finc\RecordTab; + +use Zend\ServiceManager\ServiceManager; + +/** + * Record Tab Invokable Factory Class + * for HierarchyTree tab + * + * @category VuFind + * @package RecordTab + * @author Dorian Merz <merz@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development:plugins:hierarchy_components Wiki + * + * @codeCoverageIgnore + */ +class HierarchyTreeFactory +{ + /** + * Factory for HierarchyTree tab plugin. + * + * @param ServiceManager $sm Service manager. + * + * @return HierarchyTree + */ + public function __invoke(ServiceManager $sm, $requestedName, array $options = null) + { + if (!empty($options)) { + throw new \ConfigurationException('Unexpected options'); + } + return new $requestedName( + $sm->get('VuFind\Config\PluginManager')->get('config') + ); + } +}