Different custom menu bar for a given course-working only if you use the menu.css of Afterburner

Different custom menu bar for a given course-working only if you use the menu.css of Afterburner

by Mari Cruz García -
Number of replies: 3

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.

 

Average of ratings: -
In reply to Mari Cruz García

Re: Different custom menu bar for a given course-working only if you use the menu.css of Afterburner

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi,

I thought you copied all the custommenu css from the Aaradyha theme? If not then you really need to do that, otherwise nothing will work.

Can you send me the theme so I can checkout it all for you? 

Cheers

Mary

In reply to Mary Evans

Re: Different custom menu bar for a given course-working only if you use the menu.css of Afterburner

by Mari Cruz García -

Thanks for replying, Mary. I haven't forgotten about writing the tutorial but, when I thought it was almost done, I just got this problem,

I am sending the theme to the email you got in JISC Technical UK.

Regards,

In reply to Mari Cruz García

Re: Different custom menu bar for a given course-working only if you use the menu.css of Afterburner

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Mari Cruz,

Unless you are using Moodle 2.3 this will not work. Also you do not appear to have made any changes to the custommenu in the layout files. And also, since the theme you sent me is using very old php, I am not surprised it does not do what you hoped it would.

Can you not upgrade to Moodle 2.3 as this would be much better?

I can't test your theme as I no longer use Moodle 2.2 as it has been depreciated.

Sorry I cannot help you further.

Mary