MDL-56488 boost: validate scss settings for parsable scss

* Parses the scss and fails validation if a parse error is found

* Does not detect the situation when variables are not present - this
  would involve us parsing the entire tree and would be slow. It could
  also change over time, depending on whats defined in the scss
  from themes.

* Introduces a new admin_setting_scsscode to do this
This commit is contained in:
Dan Poltawski 2016-12-14 10:47:33 +00:00
parent c4cf1c60f5
commit 0e34e46fd0
3 changed files with 41 additions and 2 deletions

View file

@ -73,13 +73,13 @@ if ($ADMIN->fulltree) {
$page = new admin_settingpage('theme_boost_advanced', get_string('advancedsettings', 'theme_boost'));
// Raw SCSS to include before the content.
$setting = new admin_setting_configtextarea('theme_boost/scsspre',
$setting = new admin_setting_scsscode('theme_boost/scsspre',
get_string('rawscsspre', 'theme_boost'), get_string('rawscsspre_desc', 'theme_boost'), '', PARAM_RAW);
$setting->set_updatedcallback('theme_reset_all_caches');
$page->add($setting);
// Raw SCSS to include after the content.
$setting = new admin_setting_configtextarea('theme_boost/scss', get_string('rawscss', 'theme_boost'),
$setting = new admin_setting_scsscode('theme_boost/scss', get_string('rawscss', 'theme_boost'),
get_string('rawscss_desc', 'theme_boost'), '', PARAM_RAW);
$setting->set_updatedcallback('theme_reset_all_caches');
$page->add($setting);