mirror of
https://github.com/moodle/moodle.git
synced 2025-03-15 05:00:06 +01:00
Merge branch 'MDL-61012_master' of https://github.com/troywilliams/moodle
This commit is contained in:
commit
7816cac9fe
@ -50,7 +50,7 @@ abstract class moodleform_mod extends moodleform {
|
||||
*/
|
||||
protected $_customcompletionelements;
|
||||
/**
|
||||
* @var string name of module
|
||||
* @var string name of module.
|
||||
*/
|
||||
protected $_modname;
|
||||
/** current context, course or module depends if already exists*/
|
||||
@ -86,13 +86,15 @@ abstract class moodleform_mod extends moodleform {
|
||||
require_once($CFG->dirroot . '/course/format/lib.php');
|
||||
$this->courseformat = course_get_format($course);
|
||||
|
||||
// Guess module name
|
||||
// Guess module name if not set.
|
||||
if (is_null($this->_modname)) {
|
||||
$matches = array();
|
||||
if (!preg_match('/^mod_([^_]+)_mod_form$/', get_class($this), $matches)) {
|
||||
debugging('Use $modname parameter or rename form to mod_xx_mod_form, where xx is name of your module');
|
||||
debugging('Rename form to mod_xx_mod_form, where xx is name of your module');
|
||||
print_error('unknownmodulename');
|
||||
}
|
||||
$this->_modname = $matches[1];
|
||||
}
|
||||
$this->init_features();
|
||||
parent::__construct('modedit.php');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user