Skip to content

Use $CFG->themedir break SCSS inclusion

Hello,

On a fresh install of Moodle 3.11.5, Adaptable 2021081005 installed in a specific location using $CFG->themedir, there's some (SCSS) inclusion PHP Warning since Adaptable base directory is derived from $CFG->dirroot.'/theme/adaptable/.

Unless I am mistaken, from lib.php, function theme_adaptable_get_main_scss_content => file_get_contents($CFG->dirroot.'/theme/adaptable/scss/main.scss') on line 56 and another on line 75

Could it be managed like in files classes/admin_setting_markdown.php / settings/templates.php and settings/importexport_settings.php ?

I used these modifications to have Adaptable working regardless of using $CFG->themedir:

$basedir = (!empty($CFG->themedir)) ? $CFG->themedir : $CFG->dirroot.'/theme';
// 56
$scss .= file_get_contents($basedir.'/adaptable/scss/main.scss');
// 75
$settingsscss .= file_get_contents($basedir.'/adaptable/scss/settings/'.$settingsheet.'.scss');

Thanks a lot for all this work !