Moodle 3.2 - Navigation Drawer

Re: Moodle 3.2 - Navigation Drawer

by Damyon Wiese -
Number of replies: 9
              // Calendar                                                                                                             
              $calendarurl = new moodle_url('/calendar/view.php', array('view' => 'month'));                                          
              $node = $coursenode->add(get_string('calendar', 'calendar'), $calendarurl, self::TYPE_CUSTOM, null, 'calendar');        
              $node->showinflatnavigation = true;                    
Example ^.
Average of ratings: Useful (1)
In reply to Damyon Wiese

Re: Moodle 3.2 - Navigation Drawer

by Martin Williams -

Could you post an example of how to remove a link? I have a client that wants to remove the Dashboard link, and I haven't been able to figure it out.

In reply to Martin Williams

Re: Moodle 3.2 - Navigation Drawer

by Vimal Saifudin -

If you want to hide dashboard from flatnavigation try this:

$this->rootnodes['home']->showinflatnavigation = false;


Search for get_string('myhome')  to find its occurrences in any other places


In reply to Vimal Saifudin

Re: Moodle 3.2 - Navigation Drawer

by Martin Williams -

Thanks for the response.

Is there a way to accomplish this without modifying the core code? I'd like to not have to make this change every time we update Moodle.

In reply to Martin Williams

Re: Moodle 3.2 - Navigation Drawer

by Bas Harkink -

For removing items there is. Just use CSS. Add the next line to the theme (custom) CSS:

[data-key="participants"] {display: none;}

To hide multiple items, just copy the line, add it to the CSS and replace "participants" with the name of the item.

For adding items you can not use SCC. Theme Fordson has the capacity to add/remove items, you might integrate that into your theme or contact the maintainer for the theme. 


On general principle I would advise to stay away from changing code in Moodle core to prevent loss of functionality during upgrades.

Average of ratings: Useful (2)
In reply to Bas Harkink

Re: Moodle 3.2 - Navigation Drawer

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Bas,

I would strongly disagree with your suggestion above, which appears to just randomly hide instances of the data-key in a themes custom CSS settings, without first adding a prefix class selector relating to the part of the page you are targeting.

Goodness me who knows what mayhem may result from such.

Mary

In reply to Mary Evans

Re: Moodle 3.2 - Navigation Drawer

by Bas Harkink -

Hello Mary,

In the instance we were using this CSS we wanted to hide the Nav drawer items in the entire site. To make sure to only target the Nav drawer add the id “#nav-drawer” to the CSS. That will result in the line below:

#nav-drawer [data-key="participants"] {display: none;}

The result will be the same and no mayhem is caused anywhere besides the nav drawer. Or am I missing something?

Average of ratings: Useful (2)
In reply to Bas Harkink

Re: Moodle 3.2 - Navigation Drawer

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

hi Bas,

I stand corrected. No you were not missing anything, but apparently I was! 

I had not realised that "data-key" only related to the Nav Drawer...it's amaising how much I have learned by making wrong assumptions. At least it gets some useful bits of information out into the open, and not left in the dark annals of Moodle code.

Thanks

Mary