Modifying Navbar menu item

Modifying Navbar menu item

by Ashef Shahrior -
Number of replies: 3

I want to add a new link to the top navbar. This new link should be read from the environment variable. How can I achieve this programmatically?

1. Which PHP file renders this navbar menu so I can populate the content with my custom link?

2. Can mustache read from an environment variable?


Average of ratings: -
In reply to Ashef Shahrior

Re: Modifying Navbar menu item

by Geoffrey Van Wyk -
Picture of Plugin developers
1. Check out this page on extending the navigation: https://moodledev.io/docs/apis/core/navigation#extending-the-navigation
2. You have to pass the variables to the render_from_template method: https://moodledev.io/docs/guides/templates#renderers
In reply to Geoffrey Van Wyk

Re: Modifying Navbar menu item

by Andreas Greiner -
Hi smile
I have the same problem. But I've been trying to do this for 2 days, but I have no success. I don't understand the 2nd point. How and where should I pass the variable? Unfortunately, I don't have a solid knowledge of renderers yet.

Thanks
In reply to Andreas Greiner

Re: Modifying Navbar menu item

by Andreas Greiner -
Ok. A lot of trys. Here my way: Created a new theme and modified the drawers.php. In this file i extended the array $primaymenu['moremenu']. Would there be a better solution?