Skip to content
Snippets Groups Projects
Commit f853d67b authored by Demian Katz's avatar Demian Katz
Browse files

More flexible sidebar support in RTL mode.

parent 4d5020a6
No related merge requests found
......@@ -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.
......
......@@ -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;
}
......
......@@ -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
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment