Inheritance in daughter themes

Inheritance in daughter themes

por Derek Chirnside -
Número de respostas: 14

I've had a quick look through some of the docs, and couldn't find the answer to this question:

What is inherited from parent theme in a daughter theme?

Everything? Nothing? Just what you decide? or . . .?

-Derek

Em resposta a 'Derek Chirnside'

Re: Inheritance in daughter themes

por Just H -

I would have thought everything; idea of a child theme is to override certain elements/add to an existing theme isn't it?

Em resposta a 'Derek Chirnside'

Re: Inheritance in daughter themes

por Gareth J Barnard -
Foto de Core developers Foto de Particularly helpful Moodlers Foto de Plugin developers
Em resposta a 'Gareth J Barnard'

Re: Inheritance in daughter themes

por Derek Chirnside -

Hello theme experts.

Thank you.

Just out of curiosity, what does https://tracker.moodle.org/browse/MDL-42961 mean?

A friend was looking at Decaf and we were thinking about child themes. He thought that not all inheritance was automatic if we went the daughter theme way.

-Derek

Em resposta a 'Derek Chirnside'

Re: Inheritance in daughter themes

por Gareth J Barnard -
Foto de Core developers Foto de Particularly helpful Moodlers Foto de Plugin developers

I think that MDL-42961 needs backing up with more evidence to justify the breakages specified in the bullet points.

However, the last is true as I've demonstrated in the 'Essentials' child theme of 'Essential': https://github.com/gjb2048/moodle-theme_essential/blob/master/essentials/lib.php#L26-L39 - but I've not tried to see if changing this: https://github.com/gjb2048/moodle-theme_essential/blob/master/essentials/config.php#L64 to the 'Essential' one would work.

Plus, the second bullet point is false: https://github.com/gjb2048/moodle-theme_essential/blob/master/essentials/config.php#L44-L61.

And indeed the third: https://github.com/gjb2048/moodle-theme_essential/blob/master/essentials/renderers/core_renderer.php and https://github.com/gjb2048/moodle-theme_essential/blob/master/essentials/renderers.php.

Em resposta a 'Derek Chirnside'

Re: Inheritance in daughter themes

por Mary Evans -
Foto de Core developers Foto de Documentation writers Foto de Peer reviewers Foto de Plugin developers Foto de Testers

The things inherited are all the parent's default settings, not the customisation.

As pointed out, the child theme is there to be not an identical copy, but as an individual with all the same features as the parent, but with the ability to change, otherwise it would just be a clone.

At the end of the day it depends what it is you want? A child (daughter) theme or a 'CLONE'.

Kind regards, 

Mary

Em resposta a 'Derek Chirnside'

Re: Inheritance in daughter themes

por Danny Wahl -

that tracker item is talking about settings, which are not inherited by child themes, see MDL-27280 for a related issue

Em resposta a 'Danny Wahl'

Re: Inheritance in daughter themes

por Derek Chirnside -

Danny, if this  MDL-27280  is still relevant, then what about updating the Fix Version?

-Derek

Em resposta a 'Derek Chirnside'

Re: Inheritance in daughter themes

por Gareth J Barnard -
Foto de Core developers Foto de Particularly helpful Moodlers Foto de Plugin developers

The 'Essentials' child theme of 'Essential' already implements the dead easy to do workaround: https://github.com/gjb2048/moodle-theme_essential/blob/master/essentials/lib.php#L26-L39 as the parent function is in the global scope.  Yes, an array of functions for 'pre-processing' would be nice, but perhaps there should be a more object orientated approach as course formats have gone with 'format_base' in 'lib.php'.  In which case it would be a simple matter of the child theme method calling the parent method when it overrode it.  No need to check for function existence as 'duh' the parent class is already known about.

Em resposta a 'Derek Chirnside'

Re: Inheritance in daughter themes

por Mary Evans -
Foto de Core developers Foto de Documentation writers Foto de Peer reviewers Foto de Plugin developers Foto de Testers

It looks like the parent only prettier...coração

Em resposta a 'Mary Evans'

Re: Inheritance in daughter themes

por Just H -

Thanks for that Mary, after the day I had need a laugh ... and your post did the trick grande sorriso

Em resposta a 'Just H'

Re: Inheritance in daughter themes

por Mary Evans -
Foto de Core developers Foto de Documentation writers Foto de Peer reviewers Foto de Plugin developers Foto de Testers

You should try changing your avatar H...the one you have is a scream!