MDL-18375 calendar: only display the choice of calendar types if there is more than one
This commit is contained in:
@@ -199,10 +199,15 @@ class course_edit_form extends moodleform {
|
||||
$mform->addElement('select', 'lang', get_string('forcelanguage'), $languages);
|
||||
$mform->setDefault('lang', $courseconfig->lang);
|
||||
|
||||
$calendartypes = array();
|
||||
$calendartypes[''] = get_string('forceno');
|
||||
$calendartypes += \core_calendar\type_factory::get_list_of_calendar_types();
|
||||
$mform->addElement('select', 'calendartype', get_string('forcecalendartype', 'calendar'), $calendartypes);
|
||||
// Multi-Calendar Support - see MDL-18375.
|
||||
$calendartypes = \core_calendar\type_factory::get_list_of_calendar_types();
|
||||
// We do not want to show this option unless there is more than one calendar type to display.
|
||||
if (count($calendartypes) > 1) {
|
||||
$calendars = array();
|
||||
$calendars[''] = get_string('forceno');
|
||||
$calendars += $calendartypes;
|
||||
$mform->addElement('select', 'calendartype', get_string('forcecalendartype', 'calendar'), $calendars);
|
||||
}
|
||||
|
||||
$options = range(0, 10);
|
||||
$mform->addElement('select', 'newsitems', get_string('newsitemsnumber'), $options);
|
||||
|
||||
+5
-1
@@ -263,7 +263,11 @@ function useredit_shared_definition(&$mform, $editoroptions = null, $filemanager
|
||||
$mform->setDefault('lang', $CFG->lang);
|
||||
|
||||
// Multi-Calendar Support - see MDL-18375.
|
||||
$mform->addElement('select', 'calendartype', get_string('preferredcalendar', 'calendar'), \core_calendar\type_factory::get_list_of_calendar_types());
|
||||
$calendartypes = \core_calendar\type_factory::get_list_of_calendar_types();
|
||||
// We do not want to show this option unless there is more than one calendar type to display.
|
||||
if (count($calendartypes) > 1) {
|
||||
$mform->addElement('select', 'calendartype', get_string('preferredcalendar', 'calendar'), $calendartypes);
|
||||
}
|
||||
|
||||
if (!empty($CFG->allowuserthemes)) {
|
||||
$choices = array();
|
||||
|
||||
Reference in New Issue
Block a user