Theme: Essential - How to customise top menu

Theme: Essential - How to customise top menu

by seaghan moriarty -
Number of replies: 16

 

Although I have turned off "Badges" and "My Files" (in Plugins > Repositories), they still appear in the top menu. Can anyone suggest where I can edit the menu contents or how to otherwise remove these 2 links from the My Dashboard menu? TIA smile

 

Average of ratings: -
In reply to seaghan moriarty

Re: Theme: Essential - How to customise top menu

by Mary Evans -

Hi,

Yes the code where the links to 'Badges' and 'Private files' can be found in ../theme/essential/renderers.php and starts at or about line 130 and looks like this...

       /*
        * This code replaces adds the My Dashboard
        * functionality to the custommenu.
        */
        $hasdisplaymydashboard = (empty($this->page->theme->settings->displaymydashboard)) ? false : $this->page->theme->settings->displaymydashboard;
        if (isloggedin() && $hasdisplaymydashboard) {
            $branchlabel = '<i class="icon-dashboard"></i>'.get_string('mydashboard', 'theme_essential');
            $branchurl   = new moodle_url('/my/index.php');
            $branchtitle = get_string('mydashboard', 'theme_essential');
            $branchsort  = 10000;
 
            $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
             $branch->add('<em><i class="icon-user"></i>'.get_string('profile').'</em>',new moodle_url('/user/profile.php'),get_string('profile'));
             $branch->add('<em><i class="icon-calendar"></i>'.get_string('pluginname', 'block_calendar_month').'</em>',new moodle_url('/calendar/view.php'),get_string('pluginname', 'block_calendar_month'));
             $branch->add('<em><i class="icon-envelope"></i>'.get_string('pluginname', 'block_messages').'</em>',new moodle_url('/message/index.php'),get_string('pluginname', 'block_messages'));
             //$branch->add('<em><i class="icon-certificate"></i>'.get_string('badges').'</em>',new moodle_url('/badges/mybadges.php'),get_string('badges'));
             //$branch->add('<em><i class="icon-file"></i>'.get_string('privatefiles', 'block_private_files').'</em>',new moodle_url('/user/files.php'),get_string('privatefiles', 'block_private_files'));
             $branch->add('<em><i class="icon-signout"></i>'.get_string('logout').'</em>',new moodle_url('/login/logout.php'),get_string('logout'));    
        }
 
        return parent::render_custom_menu($menu);
    }
   

You can either delete the above highlighted lines or just comment them out as I have done above adding the // in front of the dis-guarded php code.

Hope this helps?

Mary

Average of ratings:Useful (4)
In reply to Mary Evans

Re: Theme: Essential - How to customise top menu

by seaghan moriarty -

Ah wow - yes, this is exactly what I was hoping for ...

thanks a million Mary!  smile

In reply to seaghan moriarty

Re: Theme: Essential - How to customise top menu

by Julian Ridden -

In the next release I hope to have the theme check if these are enabled or not and then change the menu accordingly. Haven't figured out how to do that just yet.

Julian

In reply to Julian Ridden

Re: Theme: Essential - How to customise top menu

by Giampaolo Mangiaracina -

Hi, how can I change titles for "My dashboard" and "My courses" of custom menu? I need to translate them. I can't find those strings in theme language pack...

Thanks

In reply to Giampaolo Mangiaracina

Re: Theme: Essential - How to customise top menu

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
In reply to Gareth J Barnard

Re: Theme: Essential - How to customise top menu

by Giampaolo Mangiaracina -

Thank you Gareth, but I don't know how to do that... I have to copy that codes somewhere?

In reply to Giampaolo Mangiaracina

Re: Theme: Essential - How to customise top menu

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Oh, ok, umm.....

Look at http://download.moodle.org/langpack/2.6/ - find the language you want to translate into.  Note down the language code before the '.zip' - e.g. 'English - Pirate' would be 'en_ar'.  In 'essential/lang', create a folder with that code - as you can see there is already an 'en_ar'.  Then copy the 'theme_essential.php' file from the 'en' folder into the new language folder you have just created.  Edit that file and translate the strings as required.  Any strings you don't want or need to translate, remove them, as Moodle will pick them up from 'essential/lang/en/theme_essential.php' if they are not in your 'theme_essential.php'.

I hope this makes sense.

Average of ratings:Useful (1)
In reply to Giampaolo Mangiaracina

Re: Theme: Essential - How to customise top menu

by Mary Evans -

Ciao Giampaolo,

Assuming you want to add Italian translations to Essential you will need to ...

  1. create an 'it' directory for Italian translations and put it inside the essential/lang/ directory
  2. make a copy of theme_essential.php and place this inside the essential/lang/it/
  3. translate all the language strings used in Essential like...
    From this...
    /* General */
    $string['geneicsettings'] = 'General Settings';
    $string['autohide'] = 'Include Autohide Functionality';
    To this...
    / * Generale * /
    $string['geneicsettings'] = 'Impostazioni generali';
    $string['autohide'] = 'Includi Autohide Funzionalità';

    which you will find inside essential/lang/it/theme_essential.php

Which is more or less what Gareth said but with a little more detail. Be sure NOT to delete punctuation as these are important.

If you want more help please ask as this is sometimes not easy to do.

Cheers

Mary

In reply to Gareth J Barnard

Re: Theme: Essential - How to customise top menu

by Raphael López Altuna -

Hi,

I just tried to edit these strings and something seems to be wrong because nothing changes (I added the string to my language document because these words still hadn't any translation in the spanish theme_essential.php), even if I edit the english document. Perhaps that string is not being used by moodle?Every thing else in the page works so it's misterious.

raphael

In reply to Raphael López Altuna

Re: Theme: Essential - How to customise top menu

by Mary Evans -

Hi

After editing any Language file I find it best after saving all your changes to the strings is go the Site Administration > Languages > Language Packs and CLICK on Update Language Packs. When that process has completed you should get a message to say Your language packs have been updated.

Now you should see the changes you have made.

Hope this helps?

Mary

In reply to Raphael López Altuna

Re: Theme: Essential - How to customise top menu

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

You may need to Purge all Caches - language strings are not (I believe) included in the Theme Designer Mode, so even if you have that enabled, you may still need to purge caches after making changes to language strings.

Richard

In reply to Richard Oelmann

Re: Theme: Essential - How to customise top menu

by Doug Swenson -

Where can you change the font size of the menu items? The Home item is much larger than the others (Custom additions, My Courses, etc) and I want to make them consistent.

 

Thanks!

In reply to Julian Ridden

Re: Theme: Essential - How to customise top menu

by Donna Hrynkiw -

I'd love to be able to add a "My home" link to either the Dashboard or My Courses menu.

I understand this feature isn't available now. Is there somewhere we can post enhancement suggestions?

 

Just discovered an acceptable work-around: Add link for My Home to the Custom Menu

custommenuitems

My Home|https://yourmoodle/my/

 

Hrynkiw, Kwantlen Polytechnic

In reply to seaghan moriarty

Re: Theme: Essential - How to customise top menu

by poenpi cenas -

Hi Seaghan,

I am new to this community, I have been searching a thread on how to display mydashboard in the top menu but I din't find any solution to my problem, until I find you post with the screenshot, and this setup is what I'm looking for, can you share me any answer or share a thread, on how to achieve this kind of setup like in this screenshot?

Thank you and I hope you can help me on this.

Regards,

Poenapi