|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Autocomplete handler plugin manager |
| 4 | + * |
| 5 | + * PHP version 7 |
| 6 | + * |
| 7 | + * Copyright (C) Villanova University 2010. |
| 8 | + * |
| 9 | + * This program is free software; you can redistribute it and/or modify |
| 10 | + * it under the terms of the GNU General Public License version 2, |
| 11 | + * as published by the Free Software Foundation. |
| 12 | + * |
| 13 | + * This program is distributed in the hope that it will be useful, |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | + * GNU General Public License for more details. |
| 17 | + * |
| 18 | + * You should have received a copy of the GNU General Public License |
| 19 | + * along with this program; if not, write to the Free Software |
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 | + * |
| 22 | + * @category VuFind |
| 23 | + * @package Autocomplete |
| 24 | + * @author Demian Katz <demian.katz@villanova.edu> |
| 25 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
| 26 | + * @link https://vufind.org/wiki/development:plugins:autosuggesters Wiki |
| 27 | + */ |
| 28 | +namespace AutocompleteTerms\Autocomplete; |
| 29 | + |
| 30 | +/** |
| 31 | + * Autocomplete handler plugin manager |
| 32 | + * |
| 33 | + * @category VuFind |
| 34 | + * @package Autocomplete |
| 35 | + * @author Demian Katz <demian.katz@villanova.edu> |
| 36 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
| 37 | + * @link https://vufind.org/wiki/development:plugins:autosuggesters Wiki |
| 38 | + */ |
| 39 | +class PluginManager extends \VuFind\Autocomplete\PluginManager |
| 40 | +{ |
| 41 | + /** |
| 42 | + * Default plugin aliases. |
| 43 | + * |
| 44 | + * @var array |
| 45 | + */ |
| 46 | + protected $aliases = [ |
| 47 | + 'none' => 'VuFind\Autocomplete\None', |
| 48 | + 'eds' => 'VuFind\Autocomplete\Eds', |
| 49 | + 'oclcidentities' => 'VuFind\Autocomplete\OCLCIdentities', |
| 50 | + 'search2' => 'VuFind\Autocomplete\Search2', |
| 51 | + 'search2cn' => 'VuFind\Autocomplete\Search2CN', |
| 52 | + 'solr' => 'VuFind\Autocomplete\Solr', |
| 53 | + 'solrauth' => 'VuFind\Autocomplete\SolrAuth', |
| 54 | + 'solrcn' => 'VuFind\Autocomplete\SolrCN', |
| 55 | + 'solrreserves' => 'VuFind\Autocomplete\SolrReserves', |
| 56 | + 'tag' => 'VuFind\Autocomplete\Tag', |
| 57 | + // for legacy 1.x compatibility |
| 58 | + 'noautocomplete' => 'None', |
| 59 | + 'oclcidentitiesautocomplete' => 'OCLCIdentities', |
| 60 | + 'solrautocomplete' => 'Solr', |
| 61 | + 'solrauthautocomplete' => 'SolrAuth', |
| 62 | + 'solrcnautocomplete' => 'SolrCN', |
| 63 | + 'solrreservesautocomplete' => 'SolrReserves', |
| 64 | + 'tagautocomplete' => 'Tag', |
| 65 | + 'terms' => 'AutocompleteTerms\Autocomplete\Terms', |
| 66 | + ]; |
| 67 | + |
| 68 | + /** |
| 69 | + * Default plugin factories. |
| 70 | + * |
| 71 | + * @var array |
| 72 | + */ |
| 73 | + protected $factories = [ |
| 74 | + 'VuFind\Autocomplete\None' => 'Zend\ServiceManager\Factory\InvokableFactory', |
| 75 | + 'VuFind\Autocomplete\Eds' => 'VuFind\Autocomplete\EdsFactory', |
| 76 | + 'VuFind\Autocomplete\OCLCIdentities' => |
| 77 | + 'Zend\ServiceManager\Factory\InvokableFactory', |
| 78 | + 'VuFind\Autocomplete\Search2' => 'VuFind\Autocomplete\SolrFactory', |
| 79 | + 'VuFind\Autocomplete\Search2CN' => 'VuFind\Autocomplete\SolrFactory', |
| 80 | + 'VuFind\Autocomplete\Solr' => 'VuFind\Autocomplete\SolrFactory', |
| 81 | + 'VuFind\Autocomplete\SolrAuth' => 'VuFind\Autocomplete\SolrFactory', |
| 82 | + 'VuFind\Autocomplete\SolrCN' => 'VuFind\Autocomplete\SolrFactory', |
| 83 | + 'VuFind\Autocomplete\SolrReserves' => 'VuFind\Autocomplete\SolrFactory', |
| 84 | + 'VuFind\Autocomplete\Tag' => 'Zend\ServiceManager\Factory\InvokableFactory', |
| 85 | + 'AutocompleteTerms\Autocomplete\Terms' => 'AutocompleteTerms\Autocomplete\TermsFactory', |
| 86 | + ]; |
| 87 | + |
| 88 | + /** |
| 89 | + * Constructor |
| 90 | + * |
| 91 | + * Make sure plugins are properly initialized. |
| 92 | + * |
| 93 | + * @param mixed $configOrContainerInstance Configuration or container instance |
| 94 | + * @param array $v3config If $configOrContainerInstance is a |
| 95 | + * container, this value will be passed to the parent constructor. |
| 96 | + */ |
| 97 | + public function __construct($configOrContainerInstance = null, |
| 98 | + array $v3config = [] |
| 99 | + ) { |
| 100 | + $this->addAbstractFactory('AutocompleteTerms\Autocomplete\PluginFactory'); |
| 101 | + parent::__construct($configOrContainerInstance, $v3config); |
| 102 | + } |
| 103 | + |
| 104 | + /** |
| 105 | + * Return the name of the base class or interface that plug-ins must conform |
| 106 | + * to. |
| 107 | + * |
| 108 | + * @return string |
| 109 | + */ |
| 110 | + protected function getExpectedInterface() |
| 111 | + { |
| 112 | + return 'VuFind\Autocomplete\AutocompleteInterface'; |
| 113 | + } |
| 114 | +} |
0 commit comments