[Solved] Adding Specific Custom Menus via Theme

[Solved] Adding Specific Custom Menus via Theme

por Brendan Lalor -
Número de respostas: 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.

Média das avaliações:  -
Em resposta à Brendan Lalor

Re: Adding Specific Custom Menus via Theme

por Gareth J Barnard -
Imagem de Core developers Imagem de Particularly helpful Moodlers Imagem de Plugin developers

Hi Brendan,

I have done this sort of thing for a client in the past, so would do the same for you if you paid me.

Kind regards,

Gareth

Em resposta à Brendan Lalor

Re: Adding Specific Custom Menus via Theme

por Richard Oelmann -
Imagem de Core developers Imagem de Particularly helpful Moodlers Imagem de Plugin developers Imagem de Testers
Em resposta à Richard Oelmann

Re: Adding Specific Custom Menus via Theme

por 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 

Em resposta à Richard Oelmann

Re: Adding Specific Custom Menus via Theme

por 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 

Em resposta à Brendan Lalor

Re: Adding Specific Custom Menus via Theme

por 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.

Em resposta à Mary Evans

Re: Adding Specific Custom Menus via Theme

por 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).