Theme: Essential - How to customise top menu

Theme: Essential - How to customise top menu

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 微笑

 

評比平均分數: -
In reply to seaghan moriarty

Re: Theme: Essential - How to customise top menu

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

評比平均分數:Useful (4)
In reply to Mary Evans

Re: Theme: Essential - How to customise top menu

seaghan moriarty發表於

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

thanks a million Mary!  微笑

In reply to seaghan moriarty

Re: Theme: Essential - How to customise top menu

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

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

Gareth J Barnard發表於
Core developers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片
In reply to Gareth J Barnard

Re: Theme: Essential - How to customise top menu

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

Gareth J Barnard發表於
Core developers的相片 Particularly helpful Moodlers的相片 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.

評比平均分數:Useful (1)
In reply to Giampaolo Mangiaracina

Re: Theme: Essential - How to customise top menu

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

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

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

Richard Oelmann發表於
Core developers的相片 Plugin developers的相片 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

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

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

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