Hello,
I would like to ask for the help of those who have ever tried this:
https://tracker.moodle.org/browse/MDL-31043
The idea is to have a different custom menu bar in several of our Moodle courses.
In order to do so, I am following the same ‘renderer.php’ file that the themes ‘afterburner’ uses and I have changed the code of the file outputrenderers.php as MDL-31043 suggests.
I have created a child theme whose parent is our main theme and ‘base’.
The settings.php file of my child theme will include a box in which I can customise the links in the custom menu bar for all the courses that use my child theme.
This is because in the parent theme (which is my main theme), I am going to override the renderer custom_menu, use the new renderer in the file renderer.php (I have just copied and pasted this last file from the afterburner theme).
Our main theme uses its own menu.css file to display nicely the menu items, like this:
https://dl.dropboxusercontent.com/u/37798183/without_renderer.png
Since the moment that I add the code:
$THEME->rendererfactory = 'theme_overridden_renderer_factory';
To the config.php of my theme, using therefore the renderers.php file that I pasted from Afterburner, the menu items are displayed like this:
https://dl.dropboxusercontent.com/u/37798183/with_renderer.png
This is because renderes.php generates its own menu list:
// Initialise this custom menu
$content = html_writer::start_tag('ul', array('class'=>'dropdown dropdown-horizontal'));
// Render each child
foreach ($menu->get_children() as $item) {
$content .= $this->render_custom_menu_item($item);
}
// Close the open tags
$content .= html_writer::end_tag('ul');
// Return the custom menu
return $content;
I suspect that the problem lies in the class 'class'=>'dropdown dropdown-horizontal'
that is mentioned in the code of renderers.php, but it is not included probably in my theme.
I don’t know how to modify my menu.css file. The only way I have managed to have a horizontal menu bar is by using the afterburner_menu.css file in my theme and trying to replace the colours and fonts using the one of my own theme. However, this is very time consuming and I wonder if there is a fast solution.
-Which elements (id and classes) of the afterburner_menu.css should also import to the menu.css file of my theme?
Thank you very much for your help because I am really spending a lot time in this.