get the default theme as easy as possible

get the default theme as easy as possible

by Franky Just -
Number of replies: 4

Is there a easy way to get the (name of the) default theme? Without using queries?

Moodle 3

Average of ratings: -
In reply to Franky Just

Re: get the default theme as easy as possible

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

Well, the default theme for Moodle is Clean

If you mean find the theme used on your site, then go to Site Admin > Appearance > Themes > Theme Selector. That will tell you what the current selected theme is.

In reply to Richard Oelmann

Re: get the default theme as easy as possible

by Franky Just -

yes, I know. But my question is about development, not about administration. I want to fetch in the code the theme that is set by an admin as default theme. It can be done with sql, but I was wondering if there is a another route (e.g. $CFG ..?)

In reply to Franky Just

Re: get the default theme as easy as possible

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

Ah apologies Franky,

Yes, $CFG->theme will give you the current default theme for the site - although that may not be the theme being displayed at the time (can be overridden by user/course/url according to settings)

The actual theme being displayed at the time can be found from $PAGE->theme->name

HTH

Richard

Average of ratings: Useful (3)