Commit 417a273d authored by Sam Hemelryk's avatar Sam Hemelryk
Browse files

navigation MDL-20735 Fixed issue with unset cm contexts for front page course

parent 8f685009
......@@ -1281,6 +1281,11 @@ class global_navigation extends navigation_node {
}
$file = $CFG->dirroot.'/mod/'.$module->name.'/lib.php';
$function = $module->name.'_extend_navigation';
if (empty($PAGE->cm->context)) {
$PAGE->cm->context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->instance);
}
if (file_exists($file)) {
require_once($file);
if (function_exists($function)) {
......@@ -2940,6 +2945,14 @@ class settings_navigation extends navigation_node {
return;
}
if (empty($this->page->cm->context)) {
if ($this->context->instanceid === $this->page->cm->id) {
$this->page->cm->context = $this->context;
} else {
$this->page->cm->context = get_context_instance(CONTEXT_MODULE, $this->page->cm->instance);
}
}
$module = $DB->get_record('modules', array('id'=>$this->page->cm->module));
if (!$module) {
debugging('Invalid Module ID picked up while attempting to load the activity for the navigation', DEBUG_DEVELOPER);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment