From 96987707375c7b590f607202afc55c015b411ca1 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Wed, 10 Jan 2018 11:29:00 -0500
Subject: [PATCH] Modernize cover content plugin configuration. - Change
 service names to fully qualified class names. - Move configuration into
 plugin manager.

---
 module/VuFind/config/module.config.php        | 17 +------
 .../VuFind/Content/Covers/PluginManager.php   | 45 +++++++++++++++++++
 2 files changed, 46 insertions(+), 16 deletions(-)

diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php
index 7e7114d2bd7..87e9e0740ea 100644
--- a/module/VuFind/config/module.config.php
+++ b/module/VuFind/config/module.config.php
@@ -440,22 +440,7 @@ $config = [
                     'syndeticsplus' => 'VuFind\Content\TOC\Factory::getSyndeticsPlus',
                 ],
             ],
-            'content_covers' => [
-                'factories' => [
-                    'amazon' => 'VuFind\Content\Covers\Factory::getAmazon',
-                    'booksite' => 'VuFind\Content\Covers\Factory::getBooksite',
-                    'buchhandel' => 'VuFind\Content\Covers\Factory::getBuchhandel',
-                    'contentcafe' => 'VuFind\Content\Covers\Factory::getContentCafe',
-                    'syndetics' => 'VuFind\Content\Covers\Factory::getSyndetics',
-                ],
-                'invokables' => [
-                    'google' => 'VuFind\Content\Covers\Google',
-                    'librarything' => 'VuFind\Content\Covers\LibraryThing',
-                    'localfile' => 'VuFind\Content\Covers\LocalFile',
-                    'openlibrary' => 'VuFind\Content\Covers\OpenLibrary',
-                    'summon' => 'VuFind\Content\Covers\Summon',
-                ],
-            ],
+            'content_covers' => [ /* see VuFind\Content\Covers\PluginManager for defaults */ ],
             'content_reviews' => [
                 'factories' => [
                     'amazon' => 'VuFind\Content\Reviews\Factory::getAmazon',
diff --git a/module/VuFind/src/VuFind/Content/Covers/PluginManager.php b/module/VuFind/src/VuFind/Content/Covers/PluginManager.php
index d09f6e0d103..f57c1712b95 100644
--- a/module/VuFind/src/VuFind/Content/Covers/PluginManager.php
+++ b/module/VuFind/src/VuFind/Content/Covers/PluginManager.php
@@ -38,6 +38,51 @@ namespace VuFind\Content\Covers;
  */
 class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager
 {
+    /**
+     * Default plugin aliases.
+     *
+     * @var array
+     */
+    protected $aliases = [
+        'amazon' => 'VuFind\Content\Covers\Amazon',
+        'booksite' => 'VuFind\Content\Covers\Booksite',
+        'buchhandel' => 'VuFind\Content\Covers\Buchhandel',
+        'contentcafe' => 'VuFind\Content\Covers\ContentCafe',
+        'google' => 'VuFind\Content\Covers\Google',
+        'librarything' => 'VuFind\Content\Covers\LibraryThing',
+        'localfile' => 'VuFind\Content\Covers\LocalFile',
+        'openlibrary' => 'VuFind\Content\Covers\OpenLibrary',
+        'summon' => 'VuFind\Content\Covers\Summon',
+        'syndetics' => 'VuFind\Content\Covers\Syndetics',
+    ];
+
+    /**
+     * Default plugin factories.
+     *
+     * @var array
+     */
+    protected $factories = [
+        'VuFind\Content\Covers\Amazon' => 'VuFind\Content\Covers\Factory::getAmazon',
+        'VuFind\Content\Covers\Booksite' =>
+            'VuFind\Content\Covers\Factory::getBooksite',
+        'VuFind\Content\Covers\Buchhandel' =>
+            'VuFind\Content\Covers\Factory::getBuchhandel',
+        'VuFind\Content\Covers\ContentCafe' =>
+            'VuFind\Content\Covers\Factory::getContentCafe',
+        'VuFind\Content\Covers\Google' =>
+            'Zend\ServiceManager\Factory\InvokableFactory',
+        'VuFind\Content\Covers\LibraryThing' =>
+            'Zend\ServiceManager\Factory\InvokableFactory',
+        'VuFind\Content\Covers\LocalFile' =>
+            'Zend\ServiceManager\Factory\InvokableFactory',
+        'VuFind\Content\Covers\OpenLibrary' =>
+            'Zend\ServiceManager\Factory\InvokableFactory',
+        'VuFind\Content\Covers\Summon' =>
+            'Zend\ServiceManager\Factory\InvokableFactory',
+        'VuFind\Content\Covers\Syndetics' =>
+            'VuFind\Content\Covers\Factory::getSyndetics',
+    ];
+
     /**
      * Return the name of the base class or interface that plug-ins must conform
      * to.
-- 
GitLab