From 9b0363d05a906456d67bea6cf9e435c0a82543a1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Lahmann?= <lahmann@ub.uni-leipzig.de>
Date: Tue, 8 Mar 2016 12:46:33 +0100
Subject: [PATCH] refs #7166: * adjusted foundation additions in View

---
 .../src/VuFind/View/Helper/Foundation/Factory.php | 15 ++++++++++++---
 .../View/Helper/Foundation/Flashmessages.php      |  6 +++---
 .../VuFind/View/Helper/Foundation/Highlight.php   | 10 +++++-----
 .../VuFind/View/Helper/Foundation/LayoutClass.php |  8 ++++----
 .../src/VuFind/View/Helper/Foundation/Search.php  | 10 +++++-----
 5 files changed, 29 insertions(+), 20 deletions(-)

diff --git a/module/VuFind/src/VuFind/View/Helper/Foundation/Factory.php b/module/VuFind/src/VuFind/View/Helper/Foundation/Factory.php
index f2df3b3fd54..aeb79474be0 100644
--- a/module/VuFind/src/VuFind/View/Helper/Foundation/Factory.php
+++ b/module/VuFind/src/VuFind/View/Helper/Foundation/Factory.php
@@ -31,11 +31,11 @@ use Zend\ServiceManager\ServiceManager;
 /**
  * Factory for Foundation view helpers.
  *
- * @category VuFind2
+ * @category VuFind
  * @package  View_Helpers
  * @author   Demian Katz <demian.katz@villanova.edu>
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
- * @link     http://vufind.org/wiki/vufind2:developer_manual Wiki
+ * @link     https://vufind.org/wiki/development Wiki
  *
  * @codeCoverageIgnore
  */
@@ -67,8 +67,17 @@ class Factory
         $config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
         $left = !isset($config->Site->sidebarOnLeft)
             ? false : $config->Site->sidebarOnLeft;
+        $mirror = !isset($config->Site->mirrorSidebarInRTL)
+            ? true : $config->Site->mirrorSidebarInRTL;
         $offcanvas = !isset($config->Site->offcanvas)
             ? false : $config->Site->offcanvas;
+        // The right-to-left setting is injected into the layout by the Bootstrapper;
+        // pull it back out here to avoid duplicate effort, then use it to apply
+        // the mirror setting appropriately.
+        $layout = $sm->getServiceLocator()->get('viewmanager')->getViewModel();
+        if ($layout->rtl && !$mirror) {
+            $left = !$left;
+        }
         return new LayoutClass($left, $offcanvas);
     }
-}
\ No newline at end of file
+}
diff --git a/module/VuFind/src/VuFind/View/Helper/Foundation/Flashmessages.php b/module/VuFind/src/VuFind/View/Helper/Foundation/Flashmessages.php
index efbe2235b77..0d3198bddc9 100644
--- a/module/VuFind/src/VuFind/View/Helper/Foundation/Flashmessages.php
+++ b/module/VuFind/src/VuFind/View/Helper/Foundation/Flashmessages.php
@@ -19,7 +19,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * @category VuFind2
+ * @category VuFind
  * @package  View_Helpers
  * @author   Demian Katz <demian.katz@villanova.edu>
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
@@ -30,11 +30,11 @@ namespace VuFind\View\Helper\Foundation;
 /**
  * Flash message view helper
  *
- * @category VuFind2
+ * @category VuFind
  * @package  View_Helpers
  * @author   Demian Katz <demian.katz@villanova.edu>
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
- * @link     http://vufind.org/wiki/vufind2:developer_manual Wiki
+ * @link     https://vufind.org/wiki/development Wiki
  */
 class Flashmessages extends \VuFind\View\Helper\Root\Flashmessages
 {
diff --git a/module/VuFind/src/VuFind/View/Helper/Foundation/Highlight.php b/module/VuFind/src/VuFind/View/Helper/Foundation/Highlight.php
index cdfbdb481fc..0e912968445 100644
--- a/module/VuFind/src/VuFind/View/Helper/Foundation/Highlight.php
+++ b/module/VuFind/src/VuFind/View/Helper/Foundation/Highlight.php
@@ -19,22 +19,22 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * @category VuFind2
+ * @category VuFind
  * @package  View_Helpers
  * @author   Demian Katz <demian.katz@villanova.edu>
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
- * @link     http://vufind.org/wiki/vufind2:developer_manual Wiki
+ * @link     https://vufind.org/wiki/development Wiki
  */
 namespace VuFind\View\Helper\Foundation;
 
 /**
  * Highlight view helper
  *
- * @category VuFind2
+ * @category VuFind
  * @package  View_Helpers
  * @author   Demian Katz <demian.katz@villanova.edu>
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
- * @link     http://vufind.org/wiki/vufind2:developer_manual Wiki
+ * @link     https://vufind.org/wiki/development Wiki
  */
 class Highlight extends \VuFind\View\Helper\Root\Highlight
 {
@@ -46,4 +46,4 @@ class Highlight extends \VuFind\View\Helper\Root\Highlight
         $this->startTag = '<mark>';
         $this->endTag = '</mark>';
     }
-}
\ No newline at end of file
+}
diff --git a/module/VuFind/src/VuFind/View/Helper/Foundation/LayoutClass.php b/module/VuFind/src/VuFind/View/Helper/Foundation/LayoutClass.php
index 3e25d11ec35..8920d631288 100644
--- a/module/VuFind/src/VuFind/View/Helper/Foundation/LayoutClass.php
+++ b/module/VuFind/src/VuFind/View/Helper/Foundation/LayoutClass.php
@@ -20,11 +20,11 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * @category VuFind2
+ * @category VuFind
  * @package  View_Helpers
  * @author   Demian Katz <demian.katz@villanova.edu>
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
- * @link     http://vufind.org/wiki/vufind2:developer_manual Wiki
+ * @link     https://vufind.org/wiki/development Wiki
  */
 namespace VuFind\View\Helper\Foundation;
 
@@ -32,11 +32,11 @@ namespace VuFind\View\Helper\Foundation;
  * Helper class for managing bootstrap theme's high-level (body vs. sidebar) page
  * layout.
  *
- * @category VuFind2
+ * @category VuFind
  * @package  View_Helpers
  * @author   Demian Katz <demian.katz@villanova.edu>
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
- * @link     http://vufind.org/wiki/vufind2:developer_manual Wiki
+ * @link     https://vufind.org/wiki/development Wiki
  */
 class LayoutClass extends \VuFind\View\Helper\AbstractLayoutClass
 {
diff --git a/module/VuFind/src/VuFind/View/Helper/Foundation/Search.php b/module/VuFind/src/VuFind/View/Helper/Foundation/Search.php
index 148a1e2ac8d..e4a4afdd17c 100644
--- a/module/VuFind/src/VuFind/View/Helper/Foundation/Search.php
+++ b/module/VuFind/src/VuFind/View/Helper/Foundation/Search.php
@@ -19,22 +19,22 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * @category VuFind2
+ * @category VuFind
  * @package  View_Helpers
  * @author   Demian Katz <demian.katz@villanova.edu>
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
- * @link     http://vufind.org/wiki/vufind2:developer_manual Wiki
+ * @link     https://vufind.org/wiki/development Wiki
  */
 namespace VuFind\View\Helper\Foundation;
 
 /**
  * Helper class for displaying search-related HTML chunks.
  *
- * @category VuFind2
+ * @category VuFind
  * @package  View_Helpers
  * @author   Demian Katz <demian.katz@villanova.edu>
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
- * @link     http://vufind.org/wiki/vufind2:developer_manual Wiki
+ * @link     https://vufind.org/wiki/development Wiki
  */
 class Search extends \VuFind\View\Helper\AbstractSearch
 {
@@ -61,4 +61,4 @@ class Search extends \VuFind\View\Helper\AbstractSearch
         return '<a href="' . $url . '" title="' . $view->transEsc('spell_expand_alt')
             . '"><i class="icon-circle-arrow-right"></i></a>';
     }
-}
\ No newline at end of file
+}
-- 
GitLab