Closed Navigation by default

Closed Navigation by default

by Daniel Duenner -
Number of replies: 3
Hi everyone

I'm using a moodle 3.3+ installation and I would like to have a closed navigation by default for all the students.
They are allowed to open the navigation but it should be closed by default.

As example I have two examples from the moodle demo site. (https://demo.moodle.net/)

Picture with open navigation:


Picture with closed navigation:


Thanks for you help.


Average of ratings: Useful (1)
In reply to Daniel Duenner

Re: Closed Navigation by default

by Just H -

Not sure how he did it but Chris has a setting for this exact use case in the latest version of his Fordson theme. Depending on your knowledge level you could have a look at how he did it (or ask him).

Average of ratings: Useful (1)
In reply to Daniel Duenner

Re: Closed Navigation by default

by Chris Kenniburg -
Picture of Particularly helpful Moodlers Picture of Plugin developers

This was pretty simple using the layout page and a simple checkbox on the theme setting page.

Here is the layout page code: 

https://github.com/dbnschools/moodle-theme_fordson/blob/master/layout/columns2.php#L30-L34

Then on my Fordson Settings page for  Menus I added the checkbox to activate showing it nav drawer closed:

https://github.com/dbnschools/moodle-theme_fordson/blob/master/settings/menu_settings.php#L144-L150 


If you are just hacking Boost then in each of your /boost/layout files change this:

if (isloggedin()) {
    $navdraweropen = (get_user_preferences('drawer-open-nav', 'true') == 'true');
} else {
    $navdraweropen = false;
}

to this:

$navdraweropen = false;

That will make sure the nav drawer is always closed.  


Hope this helps get you in the right direction.

Chris

Average of ratings: Useful (8)
In reply to Chris Kenniburg

Re: Closed Navigation by default

by Daniel Duenner -

Hi Chris


That was exactly what I want to do.

Works perfectly fine for me.

Thanks a lot.


Greetings Daniel

Average of ratings: Useful (1)