Merge branch 'MDL-80037-403' of https://github.com/junpataleta/moodle into MOODLE_403_STABLE

This commit is contained in:
Huong Nguyen
2023-11-20 14:48:38 +07:00
2 changed files with 13 additions and 2 deletions
+1
View File
@@ -1456,6 +1456,7 @@ $string['testoutgoingmailconf_sentmail'] = 'This site has successfully sent a te
$string['testoutgoingmailconf_subject'] = '{$a->site}: test message. {$a->additional} Sent: {$a->time}';
$string['testoutgoingmailconf_subjectadditional'] = 'Additional subject';
$string['testoutgoingmailconf_toemail'] = 'To email address';
$string['themedefinedinconfigphp'] = 'The theme cannot be changed because it is set to {$a} in config.php.';
$string['themedesignermode'] = 'Theme designer mode';
$string['themedesignermodewarning'] = 'Theme designer mode is enabled. This should not be enabled on production sites as it can significantly reduce performance.';
$string['themelist'] = 'Theme list';
+12 -2
View File
@@ -40,8 +40,15 @@ if ($reset and confirm_sesskey()) {
theme_reset_all_caches();
}
$definedinconfig = array_key_exists('theme', $CFG->config_php_settings);
if ($definedinconfig) {
$forcedthemename = get_string('pluginname', 'theme_'.$CFG->theme);
// Show a notification that the theme is defined in config.php.
\core\notification::info(get_string('themedefinedinconfigphp', 'admin', $forcedthemename));
}
// Change theme.
if (!empty($choose) && confirm_sesskey()) {
if (!$definedinconfig && !empty($choose) && confirm_sesskey()) {
// Load the theme to make sure it is valid.
$theme = theme_config::load($choose);
@@ -101,7 +108,10 @@ foreach ($themes as $themename => $themedir) {
// Is this the current theme?
if ($themename == $CFG->theme) {
$rowclasses[] = 'selectedtheme';
} else {
if ($definedinconfig) {
$infocell .= html_writer::div(get_string('configoverride', 'admin'), 'alert alert-info');
}
} else if (!$definedinconfig) {
// Button to choose this as the main theme.
$setthemestr = get_string('usetheme');
$setthemeurl = new moodle_url('/theme/index.php', ['choose' => $themename, 'sesskey' => sesskey()]);