}
$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)) {
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);