diff --git a/config/vufind/config.ini b/config/vufind/config.ini index 86c369b5a86a432b391f14292a3f86ca612b539a..5935eff66151a9afcb7f86e13a9e68e9efbb054b 100644 --- a/config/vufind/config.ini +++ b/config/vufind/config.ini @@ -86,6 +86,8 @@ defaultAccountPage = Favorites admin_enabled = false ; Show sidebar on the left side instead of right sidebarOnLeft = false +; Invert the sidebarOnLeft setting for right-to-left languages? +mirrorSidebarInRTL = true ; Handle menu as an offcanvas slider at mobile sizes (in bootstrap3-based themes) offcanvas = false ; Show (true) / Hide (false) Book Bag - Default is Hide. diff --git a/module/VuFind/src/VuFind/View/Helper/AbstractLayoutClass.php b/module/VuFind/src/VuFind/View/Helper/AbstractLayoutClass.php index 633c8b222b35495ec9c2400f6741ba9b17bfa436..9df0a7c2af030489015b293f1c6fd7913b74cc0b 100644 --- a/module/VuFind/src/VuFind/View/Helper/AbstractLayoutClass.php +++ b/module/VuFind/src/VuFind/View/Helper/AbstractLayoutClass.php @@ -57,11 +57,10 @@ abstract class AbstractLayoutClass extends \Zend\View\Helper\AbstractHelper * * @param bool $left Does the sidebar go on the left? * @param bool $offcanvas Is offcanvas menu active? - * @param bool $rtl Are we displaying right-to-left? */ - public function __construct($left = false, $offcanvas = false, $rtl = false) + public function __construct($left = false, $offcanvas = false) { - $this->left = (bool) $left ^ (bool) $rtl; + $this->left = $left; $this->offcanvas = $offcanvas; } diff --git a/module/VuFind/src/VuFind/View/Helper/Bootstrap3/Factory.php b/module/VuFind/src/VuFind/View/Helper/Bootstrap3/Factory.php index ab8a50bbc03e45dc492b1abfb947eef552b2a024..8a57856eae0bf88e618010f3faac4b7ec2048af7 100644 --- a/module/VuFind/src/VuFind/View/Helper/Bootstrap3/Factory.php +++ b/module/VuFind/src/VuFind/View/Helper/Bootstrap3/Factory.php @@ -67,11 +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. + // pull it back out here to avoid duplicate effort, then use it to apply + // the mirror setting appropriately. $layout = $sm->getServiceLocator()->get('viewmanager')->getViewModel(); - return new LayoutClass($left, $offcanvas, $layout->rtl); + if ($layout->rtl && !$mirror) { + $left = !$left; + } + return new LayoutClass($left, $offcanvas); } } \ No newline at end of file