moodlemoodle-theme

How do I select a theme and change theme configuration from moodle config.php file?


I want to select a theme by setting $CFG-> value in config.php. How can I do that? Also, I want to change the brand colour in the theme by accessing theme_moove | brandcolor in the config.php file.

enter image description here

Currently, I'm able to set other values in config.php like the following.

$CFG->enablemobilewebservice = true;

$CFG->passwordpolicy = false;

$CFG->updateautocheck = false;

Solution

  • I received the answer to the question from the Moodle forum by Leon Stringer. So sharing it here, because someone might find it useful in the SO community.

    Core settings can be set by setting the corresponding $CFG property as you have stated, so the theme can be set with:

    $CFG->theme = 'moove';
    

    Plugin settings (a theme is a plugin) are set with $CFG->forced_plugin_settings. This is described in config-dist.php under "8. FORCED SETTINGS". E.g. to set theme_moove | brandcolor:

    $CFG->forced_plugin_settings = array('theme_moove'  => array('brandcolor' => '#022B78'));