custom theme not showing in theme selector

custom theme not showing in theme selector

by nabin shrestha -
Number of replies: 7

iv been trying to develope a custom theme according to https://docs.moodle.org/dev/Creating_a_theme.but it shows me an error stating...


Notice: Undefined property: stdClass::$parents in /var/www/html/moodle9/lib/outputlib.php on line 2011

i am using latest version of moodle3.2.
can someone help me with this.

Average of ratings: -
In reply to nabin shrestha

Re: custom theme not showing in theme selector

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

That seems like an error in your theme config.php. There shouldn't be a $parents, it should be

$THEME->parents = array ('parent theme here');



Average of ratings: Useful (1)
In reply to Richard Oelmann

Re: custom theme not showing in theme selector

by Dave Emsley -

My theme config.php has:

// This is a critical setting. We want to inherit from theme_boost because it provides a great starting point for SCSS bootstrap4   
// themes. We could add more than one parent here to inherit from multiple parents, and if we did they would be processed in       
// order of importance (later themes overriding earlier ones). Things we will inherit from the parent theme include                
// styles and mustache templates and some (not all) settings.
$THEME->parents = ['boost'];    

Hope this helps

Dave
In reply to nabin shrestha

Re: custom theme not showing in theme selector

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

Hi nabin,

It may help if you could copy / paste the content of your new theme's config.php that way we can see if there is an error there or not.

Cheers

Mary

In reply to nabin shrestha

Re: custom theme not showing in theme selector

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

I am not sure but looking at the outputlib.php at line 2011 it looks very much like the parent theme information is missing from your theme.

This is what it say in the outputlib.php file:

 // verify the theme configuration is OK
        if (!is_array($THEME->parents)) {
            // parents option is mandatory now
            return null;

Average of ratings: Useful (1)
In reply to nabin shrestha

Re: custom theme not showing in theme selector

by Dave Emsley -

Hi Nabin, 

You're following the Moodle 2.0 and 2.1 theme document which does have a warning on it that it is obsolete.  Not sure if the earlier themes are meant to work but have a look at...  https://docs.moodle.org/dev/Creating_a_theme_based_on_boost

The config.php for a Moodle 3.2 theme file is VERY different from the 2.1 one.


Hope this helps,


Dave



In reply to Dave Emsley

Re: custom theme not showing in theme selector

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

Hi Dave,

That may be so but people are still using the older themes because they are simple to use and for a small scale Moodle are probably all that they need, especially if their organisation cannot afford to update their computers. Lets face it, there are many Government offices in the UK that are facing the same problems, still on XP!!!

Cheers

Mary

In reply to nabin shrestha

Re: custom theme not showing in theme selector

by ETH Zürich -

in your theme's config.php check for $THEME->hidefromselector = false;  (make it false if true, or just add it at the bottom of your config file). this has nothing todo with having a parent theme of not.


Note: The theme doesn't want to be shown in the theme selector and as theme designer mode is switched off we will respect that decision.


Average of ratings: Useful (1)