// 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 ^.
Where exactly would you put this? In the layout file?
I think it must be added to
moodle/lib/navigationlib.php
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.
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
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.
For removing items there is. Just use CSS. Add the next line to the theme (custom) CSS:
[data-key="participants"] {display: none;}
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
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?
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