diff --git a/admin/settings/appearance.php b/admin/settings/appearance.php index 0844b6f4ed6..56b1c0724c8 100644 --- a/admin/settings/appearance.php +++ b/admin/settings/appearance.php @@ -349,14 +349,17 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) { // sp new lang_string('themeselector', 'admin'), $CFG->wwwroot . '/admin/themeselector.php')); // Settings page for each theme. + $ADMIN->add('appearance', new admin_category('themes', new lang_string('themesettingscustom', 'admin'))); foreach (core_component::get_plugin_list('theme') as $theme => $themedir) { $settingspath = "$themedir/settings.php"; if (file_exists($settingspath)) { - $settings = new admin_externalpage('themesetting' . $theme, new lang_string('pluginname', 'theme_'.$theme), - new moodle_url($settingspath), 'moodle/site:config', true); + $settings = new admin_settingpage("themesetting$theme", new lang_string('pluginname', "theme_$theme"), + 'moodle/site:config', true + ); include($settingspath); - if ($settings) { - $ADMIN->add('appearance', $settings); + // Add settings if not hidden (to avoid displaying the section if it appears empty in the UI). + if ($settings && !$settings->hidden) { + $ADMIN->add('themes', $settings); } } } diff --git a/lang/en/admin.php b/lang/en/admin.php index 92803fafd90..7b500fb9159 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -1458,6 +1458,7 @@ $string['themeresetcaches'] = 'Clear theme caches'; $string['themeselect'] = 'Change theme'; $string['themeselector'] = 'Themes'; $string['themesettingsadvanced'] = 'Advanced theme settings'; +$string['themesettingscustom'] = 'Custom theme settings'; $string['themeeditsettingsname'] = 'Edit theme settings \'{$a}\''; $string['themesettingsname'] = 'Theme settings \'{$a}\''; $string['themeusagereportname'] = 'Theme usage report \'{$a}\'';