mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-18375 calendar: added condition to ensure calendar type exists before loading
This commit is contained in:
parent
5989677e0f
commit
2aefba53a5
1 changed files with 7 additions and 0 deletions
|
@ -40,6 +40,13 @@ class type_factory {
|
||||||
}
|
}
|
||||||
|
|
||||||
$class = "\\calendartype_$type\\structure";
|
$class = "\\calendartype_$type\\structure";
|
||||||
|
|
||||||
|
// Ensure the calendar type exists. It may occur that a user has selected a calendar type, which was then
|
||||||
|
// deleted. If this happens we want to fall back on the Gregorian calendar type.
|
||||||
|
if (!class_exists($class)) {
|
||||||
|
$class = "\\calendartype_gregorian\\structure";
|
||||||
|
}
|
||||||
|
|
||||||
return new $class();
|
return new $class();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue