if (!$this->cm->id = add_course_module($this->cm)) {
throw new coding_exception("Unable to create the course module");
}
- // The following are used inside some few core functions, so may as well set them here.
$this->cm->coursemodule = $this->cm->id;
- $groupbuttons = ($this->course->groupmode or (!$this->course->groupmodeforce));
- if ($groupbuttons and plugin_supports('mod', $this->module->name, FEATURE_GROUPS, 0)) {
- $this->cm->groupmodelink = (!$this->course->groupmodeforce);
- } else {
- $this->cm->groupmodelink = false;
- $this->cm->groupmode = false;
- }
}
/**
throw new moodle_exception('errorcreatingactivity', 'moodle', '', $this->module->name);
}
$mod = $info->get_cm($this->cm->id);
- $mod->groupmodelink = $this->cm->groupmodelink;
- $mod->groupmode = $this->cm->groupmode;
// Trigger course module created event.
$event = \core\event\course_module_created::create(array(