Inheriting one theme from another - minimum

Inheriting one theme from another - minimum

by Howard Miller -
Number of replies: 2
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
A (slightly) hypothetical question...

If I have a working core theme - let's say 'theme A' and I want to create a new 'theme B' that inherits from it. What is the 'minimum' requirement for the theme B folder and config file so that theme B is (to start with) exactly the same.

I am, inparticular, a bit confused about what goes in $THEME->sheets. If this is empty, will it simply pick up the sheets from the parent? If I want to add an additional sheet in theme B (for the theme B changes) can I have an array with *only* the new sheet. TBH, I have tried it both ways and it doesn't *seem* to make any difference - I'd like to be sure though.

Again, does $THEME->parents simply need to be the name of the parent or something else. This *does* seem to matter. If I don't put the same list of parents as the parent already has (plus the parents name) it breaks. I.e. this always needs to have 'base' defined somewhere.

Seems oddly inconsistent to me - hence the confusion.

EDIT:
Actually... having pondered this a bit more. Two points...
1) There's at least one post here and I have spoken to people who 'clone' a core theme by copying the thing completely and then changing the name everywhere. My interpretation is that this is almost always NOT the thing to do. I'm not sure that (if I'm right) this is made clear enough.
2) If you do decide to 'inherit' a theme - the config settings are confusing. Clearly some simply inherit 'automagically' from the parent, some need set as they where in the parent and some are slightly different again. Once again, some documentation for this would be nice.

I don't write new themes - well I try not to. I like to take an existing theme and bodge it up a bit for a client. The methodology for this could be clearer. The docs and - dare I say it - the theme engine itself seem geared to people building big new themes.
Average of ratings: -
In reply to Howard Miller

Re: Inheriting one theme from another - minimum

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

Hi Howard,

Try this discussion here - its a minimal theme I produced for someone wanting to customise boxxie and instructions to go with it.It's essentially what i am using in work where i have a single main theme and then I'm constructing a number of child themes to make small adjustments for different groups of students with specific accessibility requirements (larger fonts, particular colour backgrounds/fonts etc.)

It does depend what you want out of a theme, as Mary and I discussed recently - a child theme works well if you have a main theme which is fairly standard, but if it uses a lot of settings/lib/other additional files, these are not necessarily available then to the child unless you copy them into the child folder as well. You can then get to the stage where you might as well clone the theme.

The minimal theme referred to is specifically for Boxxie but can be adapted to other themes easily. Also as I learned after, the config file can be made even more minimal by removing all the $THEME->layouts = array( section as it was not using any changes to the layouts - it would then call the default layouts from the parent theme anyway as I understand the process.

HTH
Richard

In reply to Howard Miller

Re: Inheriting one theme from another - minimum

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

Hi Howard,

I answered this in my other answer about the anomaly theme...how strange, especially when I had not read this!  Is this ESP? Spooky!