Creating new Moodle Theme (V2.2)

Creating new Moodle Theme (V2.2)

by Constance Horne -
Number of replies: 7

I am trying to copy an existing 2.2 theme (Afterburner) to modify it to match my 1.9 theme. I have copied the Afterburner folder (and files) and given it another name but I don't see it in the theme selector (by that name).  Note: My Linix guru has made it 'see-able' to the webserver.

Is there something I am missing here?

HELP!

Average of ratings: -
In reply to Constance Horne

Re: Creating new Moodle Theme (V2.2)

by Gavin Henrick -
Picture of Plugin developers

Hi Constance,


Have you followed the steps outlined here:  http://docs.moodle.org/dev/Themes_2.0_how_to_clone_a_Moodle_2.0_theme


G

In reply to Gavin Henrick

Re: Creating new Moodle Theme (V2.2)

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

Constance - do note this line on the page Gavin has given you the link for

And basically that's it as far as this theme is concerned. However there are some themes which contain far more files and directories, like renderers, lib and settings PHP as well as Javascript, jQuery and other customisable elements of a Moodle theme.

Afterburner does have additional files e.g. renderers.php and you will need to go through them changing the theme name references (I use Find/Replace) .

What might be easier is to simply use Afterburner as a parent theme - you then need a fairly straightforward config.php and a css file to make the changes you want (in a styles folder in the 'child' theme). The advantage of this is that you would benefit from any updates to the parent theme without having to re-adjust your own cloned version.

The post here explains a minimal child theme I made for someone a while back - that was for Boxxie, but it should work if you change the parent theme in the config.php to afterburner instead of boxxie: and you can make it even more minimal by getting rid of the layouts array if you don't plan on making any changes to the layouts. I'm currently using this theme to make a 'family' of themes for my university.

Cloning and using child/parent themes are two different ways of reaching the same end, both have advantages and which you use is upto you. My personal selection comes down to the decision that if its either a core theme or one that I know gets a lot of development (e.g. decaf) I tend to use it as a parent. If I am making a theme that is going to use some elements of an existing one, but I'm going to be making so many changes that in essence it becomes a different theme (especially if those changes are to layouts) I clone it. I hasten to add again - this is my personal decision making process and even that isn't fixed in stone smile It's all about choices and others may have alternative, equally valid, opinions smile

Richard

In reply to Richard Oelmann

Re: Creating new Moodle Theme (V2.2)

by Constance Horne -

Both of your posts were excellent!

In all of my searching through the documents, I never found the cloning page at http://docs.moodle.org/dev/Themes_2.0_how_to_clone_a_Moodle_2.0_theme. Perhaps more links need to be made to it.

And, yes, afterburner has lots of files that need the modification for a true copy to work. I may also try your suggestion of pointing back to the main afterburner theme.

Thank you both!

In reply to Constance Horne

Re: Creating new Moodle Theme (V2.2)

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

Hi Constance,

The files you need to change afterburner to your theme name are as follows:

lang/en/theme_afterburner.php (you will need to look inside this file too and decide what you need to change)

renderers.php (1 instance on line 3: class theme_afterburner_core_renderer

settings.php (9 instances of theme_afterburner

lib.php (3 instances of function afterburner

lib.php (2 instances of $css = afterburner

config.php $THEME->name = 'afterburner';

$THEME->sheets = array(
    'afterburner_layout',   /** Must come first: Page layout **/
    'afterburner_styles',   /** Must come second: default styles **/
    'afterburner_menu',
    'afterburner_blocks',
    'afterburner_mod',
    'afterburner_calendar',
    'afterburner_dock',

$THEME->csspostprocess = 'afterburner_process_css';

You can safely delete the version.php as it's not needed.

after you have done all these changes purge all caches

Site Administration > Development > Purge all caches

them logout of your site and then log back in. If the theme is accepted you should get a notification straight away to say a new plugin has been detected and will be installed.

If you don't get this then turn on debugging...

Site Administration > Development > Debugging

if you don't get any warnings go to Notifications...

Site Administration > Notifications and the new settings page should appear for your renamed theme.

If that is there then you can try selecting your new theme from the Theme selector.

HTH

Mary

In reply to Mary Evans

Re: Creating new Moodle Theme (V2.2)

by Constance Horne -

Excellent post, Mary. I did find and fix those files after the first two posts pointed me in the correct direction. I was able to select it.

Now to just get it looking like I want it...thoughtful

In reply to Mary Evans

Re: Creating new Moodle Theme (V2.2)

by Andrew Steele -

Hi Mary,

This was a very useful post. Thanks.  However, I ended up with an error:

Debug info: Plugin installed in wrong folder.
 
I discovered that this was a simple edit to the version.php file.  I misunderstood the comment that version.php wasn't used.  It was in Moodle 2.2 This might help anyone else who happens to pass tghis way ;)
 
Andrew