MDL-35260 Course formats may have settings, be enabled, disabled and uninstalled
This commit is contained in:
+11
-2
@@ -113,11 +113,20 @@ class course_edit_form extends moodleform {
|
||||
$mform->hardFreeze('summary_editor');
|
||||
}
|
||||
|
||||
$courseformats = get_plugin_list('format');
|
||||
$courseformats = get_sorted_course_formats(true);
|
||||
$formcourseformats = array();
|
||||
foreach ($courseformats as $courseformat => $formatdir) {
|
||||
foreach ($courseformats as $courseformat) {
|
||||
$formcourseformats[$courseformat] = get_string('pluginname', "format_$courseformat");
|
||||
}
|
||||
if (isset($course->format)) {
|
||||
$course->format = course_get_format($course)->get_format(); // replace with default if not found
|
||||
if (!in_array($course->format, $courseformats)) {
|
||||
// this format is disabled. Still display it in the dropdown
|
||||
$formcourseformats[$course->format] = get_string('withdisablednote', 'moodle',
|
||||
get_string('pluginname', 'format_'.$course->format));
|
||||
}
|
||||
}
|
||||
|
||||
$mform->addElement('select', 'format', get_string('format'), $formcourseformats);
|
||||
$mform->addHelpButton('format', 'format');
|
||||
$mform->setDefault('format', $courseconfig->format);
|
||||
|
||||
Reference in New Issue
Block a user