MDL-80302 completion: Improve default completion error tracking
Co-authored-by: Sara Arjona <[email protected]>
This commit is contained in:
co-authored by
Sara Arjona
parent
1c530d86d1
commit
fcbe53778d
@@ -14,6 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use core_completion\manager;
|
||||
|
||||
/**
|
||||
* Default activity completion form
|
||||
*
|
||||
@@ -68,34 +70,16 @@ class core_completion_defaultedit_form extends core_completion_edit_base_form {
|
||||
* @return moodleform_mod|null
|
||||
*/
|
||||
protected function get_module_form() {
|
||||
global $CFG, $PAGE;
|
||||
|
||||
if ($this->_moduleform) {
|
||||
return $this->_moduleform;
|
||||
}
|
||||
|
||||
$modnames = array_keys($this->get_module_names());
|
||||
$modname = $modnames[0];
|
||||
$course = $this->course;
|
||||
|
||||
$modmoodleform = "$CFG->dirroot/mod/$modname/mod_form.php";
|
||||
if (file_exists($modmoodleform)) {
|
||||
require_once($modmoodleform);
|
||||
} else {
|
||||
throw new \moodle_exception('noformdesc');
|
||||
}
|
||||
|
||||
list($module, $context, $cw, $cmrec, $data) = prepare_new_moduleinfo_data($course, $modname, 0, $this->get_suffix());
|
||||
$data->return = 0;
|
||||
$data->sr = 0;
|
||||
$data->add = $modname;
|
||||
|
||||
// Initialise the form but discard all JS requirements it adds, our form has already added them.
|
||||
$mformclassname = 'mod_'.$modname.'_mod_form';
|
||||
$PAGE->start_collecting_javascript_requirements();
|
||||
$this->_moduleform = new $mformclassname($data, 0, $cmrec, $course);
|
||||
$this->_moduleform->set_suffix('_' . $modname);
|
||||
$PAGE->end_collecting_javascript_requirements();
|
||||
$this->_moduleform = manager::get_module_form(
|
||||
modname: $modnames[0],
|
||||
course: $this->course,
|
||||
suffix: $this->get_suffix(),
|
||||
);
|
||||
|
||||
return $this->_moduleform;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user