Clean theme - add a home button in custom menu items

Clean theme - add a home button in custom menu items

Anders Krantz
Number of replies: 5
Hi,

I am pretty new to moodle and to the clean theme.

I am trying to display a home button and in general try to use buttons for custom menu items. I have tried the font awesome tweak for the Essential theme, but this does not seem to work for the Clean theme.

Anyone have any suggestions on how to use buttons instead of regular text in clean theme? Specifically I am trying to remove the short name for the site and replace it with an "home" button...

I am running moodle v. 2.6.

Any help is very appreciated.
평균 등급 : -
In reply to Anders Krantz

Re: Clean theme - add a home button in custom menu items

Mary Evans

Hi,

If you look in the Clean theme layout directory you will find all the layout files used in that theme.

In the header of each of those files where the header navbar exists you will find this PHP code...

<a class="brand" href="<?php echo $CFG->wwwroot;?>"><?php echo format_string($SITE->shortname, true, array('context' => context_course::instance(SITEID))); ?></a>


To make this into a button you can change it this...

<a class="btn btn-default" href="<?php echo $CFG->wwwroot;?>"><i class="icon icon-home"></i>  <?php echo get_string('home');  ?></a>


which is basically using the Bootstrap mark-up for a button.

Hope this helps?

Mary

In reply to Mary Evans

Re: Clean theme - add a home button in custom menu items

Anders Krantz

Hi,


Firts of all, thanks for your reply Mary.


This is what i finally did, i replaced the code in /theme/layouts around line 56 with the following:

<a class="brand" href="<?php echo $CFG->wwwroot;?>"><i class="icon-home"></i>
            </a>


Then i added the Font Awesome as additional htlm in;  Site administration/Apperance/Additional HTML:

<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css" rel="stylesheet">

I added it in "Within Head".

It looks great. Thanks a lot for your help!

/

Anders

In reply to Anders Krantz

Re: Clean theme - add a home button in custom menu items

Mary Evans

Have you tried to see if it works without the Font Awesome CSS because as far as I know the icon is coming from theme/bootstrapbase/pix/glyphicon sprite image.

In reply to Mary Evans

Re: Clean theme - add a home button in custom menu items

Anders Krantz

Hi,

Yeah it works without Font Awesome CSS. The default (bootstrap) works fine.

Thanks again for your help.