Skip to content
Snippets Groups Projects
Commit ecb955e0 authored by Tim Hunt's avatar Tim Hunt
Browse files

Moodle 4.0: avoid deprecated warning from a renamed class #841

parent dbf32e4c
Branches
No related tags found
No related merge requests found
......@@ -36,7 +36,12 @@ $question = question_bank::load_question($questionid);
// Process any other URL parameters, and do require_login.
list($context, $seed, $urlparams) = qtype_stack_setup_question_test_page($question);
// Support both Moodle 4.x and 3.x.
if (class_exists('\core_question\local\bank\question_edit_contexts')) {
$contexts = new \core_question\local\bank\question_edit_contexts($context);
} else {
$contexts = new question_edit_contexts($context);
}
// Check permissions.
question_require_capability_on($questiondata, 'edit');
......
......@@ -48,8 +48,13 @@ class editform_test extends qtype_stack_edit_form {
$fakequestion->formoptions->movecontext = null;
$fakequestion->formoptions->repeatelements = true;
$fakequestion->inputs = null;
parent::__construct(new moodle_url('/'), $fakequestion, $category,
new question_edit_contexts($syscontext));
// Support both Moodle 4.x and 3.x.
if (class_exists('\core_question\local\bank\question_edit_contexts')) {
$contexts = new \core_question\local\bank\question_edit_contexts($syscontext);
} else {
$contexts = new question_edit_contexts($syscontext);
}
parent::__construct(new moodle_url('/'), $fakequestion, $category, $contexts);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment