MDL-58267 completion: style and capabilities cleanup
Part of MDL-58138 epic
This commit is contained in:
committed by
Jake Dallimore
parent
7f53e8aa22
commit
a64a9f9ce4
@@ -83,41 +83,7 @@ abstract class core_completion_edit_base_form extends moodleform {
|
||||
*
|
||||
* @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 {
|
||||
print_error('noformdesc');
|
||||
}
|
||||
|
||||
list($module, $context, $cw, $cmrec, $data) = prepare_new_moduleinfo_data($course, $modname, 0);
|
||||
$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';
|
||||
if (!defined('PHPUNIT_TEST') || !PHPUNIT_TEST) {
|
||||
$PAGE->start_collecting_javascript_requirements();
|
||||
}
|
||||
$this->_moduleform = new $mformclassname($data, 0, $cmrec, $course);
|
||||
if (!defined('PHPUNIT_TEST') || !PHPUNIT_TEST) {
|
||||
$PAGE->end_collecting_javascript_requirements();
|
||||
}
|
||||
|
||||
return $this->_moduleform;
|
||||
}
|
||||
abstract protected function get_module_form();
|
||||
|
||||
/**
|
||||
* If all selected modules are of the same module type, adds custom completion rules from this module type
|
||||
|
||||
Reference in New Issue
Block a user