MDL-85391 course: Handle null course urls
Course urls may be null when navigation is set to true. The return value from course_get_url being null was not being handled before this change, which could lead to an exception causing the page not to load. It also handles null urls in the course index in Boost so that they are not a link to what ever the current page is. If either the first or last section in a format did not a return a url under the Classic theme there would still be a link displayed with a link to the current page the user is on. After this change no link would be displayed in this case.
This commit is contained in:
+1
-1
@@ -2993,7 +2993,7 @@ function get_sorted_course_formats($enabledonly = false) {
|
||||
* @param array $options options for view URL. At the moment core uses:
|
||||
* 'navigation' (bool) if true and section has no separate page, the function returns null
|
||||
* 'sr' (int) used by multipage formats to specify to which section to return
|
||||
* @return moodle_url The url of course
|
||||
* @return moodle_url|null The url of course
|
||||
*/
|
||||
function course_get_url($courseorid, $section = null, $options = array()) {
|
||||
return course_get_format($courseorid)->get_view_url($section, $options);
|
||||
|
||||
Reference in New Issue
Block a user