From c33a55abc73cf5d73be1330cfc79d5d19d9bcfae Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Thu, 26 Apr 2018 16:08:06 -0400
Subject: [PATCH] Create default search home action.

---
 .../VuFind/src/VuFind/Controller/AbstractSearch.php   | 10 ++++++++++
 .../VuFind/src/VuFind/Controller/AuthorController.php |  6 ++----
 .../src/VuFind/Controller/AuthorityController.php     |  4 ++--
 .../src/VuFind/Controller/BrowZineController.php      | 10 ----------
 .../src/VuFind/Controller/CombinedController.php      | 10 ----------
 module/VuFind/src/VuFind/Controller/EITController.php | 11 -----------
 module/VuFind/src/VuFind/Controller/EdsController.php |  2 +-
 .../src/VuFind/Controller/LibGuidesController.php     | 10 ----------
 .../src/VuFind/Controller/Pazpar2Controller.php       | 11 -----------
 .../VuFind/src/VuFind/Controller/PrimoController.php  | 10 ----------
 module/VuFind/src/VuFind/Controller/TagController.php |  2 +-
 module/VuFind/src/VuFind/Controller/WebController.php | 11 -----------
 .../src/VuFind/Controller/WorldcatController.php      | 11 -----------
 13 files changed, 16 insertions(+), 92 deletions(-)

diff --git a/module/VuFind/src/VuFind/Controller/AbstractSearch.php b/module/VuFind/src/VuFind/Controller/AbstractSearch.php
index 31574d8938e..2e03548da99 100644
--- a/module/VuFind/src/VuFind/Controller/AbstractSearch.php
+++ b/module/VuFind/src/VuFind/Controller/AbstractSearch.php
@@ -242,6 +242,16 @@ class AbstractSearch extends AbstractBase
         };
     }
 
+    /**
+     * Home action
+     *
+     * @return mixed
+     */
+    public function homeAction()
+    {
+        return $this->createViewModel();
+    }
+
     /**
      * Send search results to results view
      *
diff --git a/module/VuFind/src/VuFind/Controller/AuthorController.php b/module/VuFind/src/VuFind/Controller/AuthorController.php
index fba275758af..e659071771e 100644
--- a/module/VuFind/src/VuFind/Controller/AuthorController.php
+++ b/module/VuFind/src/VuFind/Controller/AuthorController.php
@@ -95,10 +95,8 @@ class AuthorController extends AbstractSearch
         // If an author was requested, forward to the results page; otherwise,
         // display the search form:
         $author = $this->params()->fromQuery('author');
-        if (!empty($author)) {
-            return $this->forwardTo('Author', 'Results');
-        }
-        return $this->createViewModel();
+        return !empty($author)
+            ? $this->forwardTo('Author', 'Results') : parent::homeAction();
     }
 
     /**
diff --git a/module/VuFind/src/VuFind/Controller/AuthorityController.php b/module/VuFind/src/VuFind/Controller/AuthorityController.php
index 7a747fe121c..d560c24ce3e 100644
--- a/module/VuFind/src/VuFind/Controller/AuthorityController.php
+++ b/module/VuFind/src/VuFind/Controller/AuthorityController.php
@@ -64,8 +64,8 @@ class AuthorityController extends AbstractSearch
             return $this->forwardTo('Authority', 'Record');
         }
 
-        // Do nothing -- just display template
-        return $this->createViewModel();
+        // Default behavior:
+        return parent::homeAction();
     }
 
     /**
diff --git a/module/VuFind/src/VuFind/Controller/BrowZineController.php b/module/VuFind/src/VuFind/Controller/BrowZineController.php
index eedebb315d1..0bfe9da11cf 100644
--- a/module/VuFind/src/VuFind/Controller/BrowZineController.php
+++ b/module/VuFind/src/VuFind/Controller/BrowZineController.php
@@ -51,16 +51,6 @@ class BrowZineController extends AbstractSearch
         parent::__construct($sm);
     }
 
-    /**
-     * Home action
-     *
-     * @return mixed
-     */
-    public function homeAction()
-    {
-        return $this->createViewModel();
-    }
-
     /**
      * Search action -- call standard results action
      *
diff --git a/module/VuFind/src/VuFind/Controller/CombinedController.php b/module/VuFind/src/VuFind/Controller/CombinedController.php
index 9caa23b02a0..8b9a3ca2732 100644
--- a/module/VuFind/src/VuFind/Controller/CombinedController.php
+++ b/module/VuFind/src/VuFind/Controller/CombinedController.php
@@ -53,16 +53,6 @@ class CombinedController extends AbstractSearch
         parent::__construct($sm);
     }
 
-    /**
-     * Home action
-     *
-     * @return mixed
-     */
-    public function homeAction()
-    {
-        return $this->createViewModel();
-    }
-
     /**
      * Single result action (used for AJAX)
      *
diff --git a/module/VuFind/src/VuFind/Controller/EITController.php b/module/VuFind/src/VuFind/Controller/EITController.php
index 282b040d12d..b38f4dfd7e6 100644
--- a/module/VuFind/src/VuFind/Controller/EITController.php
+++ b/module/VuFind/src/VuFind/Controller/EITController.php
@@ -65,17 +65,6 @@ class EITController extends AbstractSearch
             && $config->Record->next_prev_navigation;
     }
 
-    /**
-     * Home action
-     *
-     * @return mixed
-     */
-    public function homeAction()
-    {
-        // Set up default parameters:
-        return $this->createViewModel();
-    }
-
     /**
      * Search action -- call standard results action
      *
diff --git a/module/VuFind/src/VuFind/Controller/EdsController.php b/module/VuFind/src/VuFind/Controller/EdsController.php
index 055487be092..cb49ea2d27e 100644
--- a/module/VuFind/src/VuFind/Controller/EdsController.php
+++ b/module/VuFind/src/VuFind/Controller/EdsController.php
@@ -92,7 +92,7 @@ class EdsController extends AbstractSearch
     public function homeAction()
     {
         $this->setUp();
-        return $this->createViewModel();
+        return parent::homeAction();
     }
 
     /**
diff --git a/module/VuFind/src/VuFind/Controller/LibGuidesController.php b/module/VuFind/src/VuFind/Controller/LibGuidesController.php
index 1a99d2187b8..a31fa3c6bf3 100644
--- a/module/VuFind/src/VuFind/Controller/LibGuidesController.php
+++ b/module/VuFind/src/VuFind/Controller/LibGuidesController.php
@@ -51,16 +51,6 @@ class LibGuidesController extends AbstractSearch
         parent::__construct($sm);
     }
 
-    /**
-     * Home action
-     *
-     * @return mixed
-     */
-    public function homeAction()
-    {
-        return $this->createViewModel();
-    }
-
     /**
      * Is the result scroller active?
      *
diff --git a/module/VuFind/src/VuFind/Controller/Pazpar2Controller.php b/module/VuFind/src/VuFind/Controller/Pazpar2Controller.php
index 32fa508f775..d49a9c6af5c 100644
--- a/module/VuFind/src/VuFind/Controller/Pazpar2Controller.php
+++ b/module/VuFind/src/VuFind/Controller/Pazpar2Controller.php
@@ -51,17 +51,6 @@ class Pazpar2Controller extends AbstractSearch
         parent::__construct($sm);
     }
 
-    /**
-     * Home action
-     *
-     * @return mixed
-     */
-    public function homeAction()
-    {
-        // Set up default parameters:
-        return $this->createViewModel();
-    }
-
     /**
      * Search action -- call standard results action
      *
diff --git a/module/VuFind/src/VuFind/Controller/PrimoController.php b/module/VuFind/src/VuFind/Controller/PrimoController.php
index 1c950799d78..f511f36cdf6 100644
--- a/module/VuFind/src/VuFind/Controller/PrimoController.php
+++ b/module/VuFind/src/VuFind/Controller/PrimoController.php
@@ -52,16 +52,6 @@ class PrimoController extends AbstractSearch
         parent::__construct($sm);
     }
 
-    /**
-     * Home action
-     *
-     * @return mixed
-     */
-    public function homeAction()
-    {
-        return $this->createViewModel();
-    }
-
     /**
      * Is the result scroller active?
      *
diff --git a/module/VuFind/src/VuFind/Controller/TagController.php b/module/VuFind/src/VuFind/Controller/TagController.php
index d5906cd2b9d..5866d0c8b07 100644
--- a/module/VuFind/src/VuFind/Controller/TagController.php
+++ b/module/VuFind/src/VuFind/Controller/TagController.php
@@ -62,6 +62,6 @@ class TagController extends AbstractSearch
         if (!$this->tagsEnabled()) {
             throw new ForbiddenException('Tags disabled');
         }
-        return $this->resultsAction();
+        return parent::homeAction();
     }
 }
diff --git a/module/VuFind/src/VuFind/Controller/WebController.php b/module/VuFind/src/VuFind/Controller/WebController.php
index 16d92cea09c..59f5228f96a 100644
--- a/module/VuFind/src/VuFind/Controller/WebController.php
+++ b/module/VuFind/src/VuFind/Controller/WebController.php
@@ -51,17 +51,6 @@ class WebController extends AbstractSearch
         parent::__construct($sm);
     }
 
-    /**
-     * Home action
-     *
-     * @return \Zend\View\Model\ViewModel
-     */
-    public function homeAction()
-    {
-        // Do nothing -- just display template
-        return $this->createViewModel();
-    }
-
     /**
      * Process the jumpto parameter -- either redirect to a specific record and
      * return view model, or ignore the parameter and return false.
diff --git a/module/VuFind/src/VuFind/Controller/WorldcatController.php b/module/VuFind/src/VuFind/Controller/WorldcatController.php
index ce46bdfe9f6..87549743682 100644
--- a/module/VuFind/src/VuFind/Controller/WorldcatController.php
+++ b/module/VuFind/src/VuFind/Controller/WorldcatController.php
@@ -64,17 +64,6 @@ class WorldcatController extends AbstractSearch
             && $config->Record->next_prev_navigation;
     }
 
-    /**
-     * Home action
-     *
-     * @return mixed
-     */
-    public function homeAction()
-    {
-        // Set up default parameters:
-        return $this->createViewModel();
-    }
-
     /**
      * Search action -- call standard results action
      *
-- 
GitLab