[Solved] Adding Specific Custom Menus via Theme

[Solved] Adding Specific Custom Menus via Theme

על ידי Brendan Lalor בתאריך
מספר תגובות: 6

Within my state college system, we have specific custom menus shared by all and only those who adopt our "Castleton theme" (it's based on More). So it would be nice if we could just add those menu items to the Castleton theme. I would love to override 'custommenuitems' using code in the Castleton theme, so that these links would be rendered in the custom menu theme-wide. 

Is there a procedure for adding a theme-based override of the 'custommenuitems' array? 

Or a model of the PHP for this? (I have seen lots of models of PHP for adding courses or categories as extensions of the custom menu. But those don't show me how to do the simpler thing I need to do - add a specific set of institutional urls to the menu.)

Thanks for any pointers!

(Edited by Gareth J Barnard - original submission Tuesday, 18 November 2014, 4:28 AM) - Added [Solved]  to title.

ממוצע דרוגים: -
בתגובה ל: Brendan Lalor

Re: Adding Specific Custom Menus via Theme

על ידי Richard Oelmann בתאריך
תמונה של Core developers תמונה של Particularly helpful Moodlers תמונה של Plugin developers תמונה של Testers
בתגובה ל: Richard Oelmann

Re: Adding Specific Custom Menus via Theme

על ידי Brendan Lalor בתאריך

Thank you, Richard; that is a helpful tutorial. 

My purpose is even simpler, as I do not need to make a textarea for links available on a theme admin page. I would prefer directly to insert the 'custommenuitems' array in settings.php, or wherever it makes sense to do so. 

No discovering such a more direct solution, I will certainly spend some time figuring out how the code in your linked tutorial can serve the purpose. (My attempt to use it shut down my theme; so it's not that simple for me.) 

Thanks, and still looking for how to override 'custommenuitems' by injecting my own array. 

 ~Brendan 

בתגובה ל: Richard Oelmann

Re: Adding Specific Custom Menus via Theme

על ידי Brendan Lalor בתאריך

Richard, 

Following the instructions via your link worked!: 

  • It adds a custommenuitems textarea to the theme's own settings. 
  • I was able to set my existing custommenuitems array as the default text. 

Many, many  thanks. 

~Brendan 

בתגובה ל: Brendan Lalor

Re: Adding Specific Custom Menus via Theme

על ידי Mary Evans בתאריך

I hope you did not add the renderer as that has nothing to do with adding the extra menu. It is just that the person who wrote the tutorial liked that particular menu design which needed a renderer. BootstrapBase has its own menu renderer...so should work ok.

בתגובה ל: Mary Evans

Re: Adding Specific Custom Menus via Theme

על ידי Brendan Lalor בתאריך

Thanks, Mary. I skipped that step, because, as you indicate, we've already got renderer.php in the theme (which we cloned from More).