MDL-65029 questions: refactor generation of question div id

We are planning to change the id in Moodle 3.7. However, the new
method name has been back-ported to stable branches, because we
know a lot of third-party question types like to have a single
branch which supports multiple Moodle versions.
This commit is contained in:
Tim Hunt
2019-03-29 13:44:46 +00:00
parent d28abb632d
commit 403f2d450c
5 changed files with 17 additions and 4 deletions
+13
View File
@@ -359,6 +359,19 @@ class question_attempt {
return 'q' . $this->usageid . ':' . $this->slot . '_';
}
/**
* When the question is rendered, this unique id is added to the
* outer div of the question. It can be used to uniquely reference
* the question from JavaScript.
*
* Note, this is not truly unique. It will be changed in Moodle 3.7. See MDL-65029.
*
* @return string id added to the outer <div class="que ..."> when the question is rendered.
*/
public function get_outer_question_div_unique_id() {
return 'q' . $this->slot;
}
/**
* Get one of the steps in this attempt.
*