Modifying Navbar menu item

Modifying Navbar menu item

autor Ashef Shahrior -
Počet odpovedí: 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?


Priemer hodnotení : -
V odpovedi na Ashef Shahrior

Re: Modifying Navbar menu item

autor Geoffrey Van Wyk -
Obrázok: 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
V odpovedi na Geoffrey Van Wyk

Re: Modifying Navbar menu item

autor Andreas Greiner -
Hi Úsmev
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
V odpovedi na Andreas Greiner

Re: Modifying Navbar menu item

autor 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?