weekly release 2.8dev
[moodle.git] / question / upgrade.txt
CommitLineData
181393aa
TH
1This files describes API changes for code that uses the question API.
2
efa5155a
RM
3=== 2.7 ===
4
51) Changes to class question_bank_view:
6
7 Filters, including $recurse and $showhidden, are now implemented as
d62382d1 8 pluggable \core_question\bank\search\condition classes.
efa5155a
RM
9
10 Therefore $recurse and $showhidden are no longer passed to the following functions:
11 protected function display_options [deprecated, use display_options_form()]
12 protected function build_query_sql [deprecated, use build_query()]
13
d62382d1 14 protected function display_category_form() is deprecated. Use \core_question\bank\search\category_condition
efa5155a 15
d62382d1 16 protected function display_category_form_checkbox deprecated use html_writer::checkbox and separate JavaScript
efa5155a
RM
17
18To add filters, local plugins can now implement the function local_[pluginname]_get_question_bank_search_conditions,
19
d62382d1 20
181393aa
TH
21=== 2.6 ===
22
b07ef13b
DP
231) Modules using the question bank MUST now declare their use of it with the xxx_supports()
24 flag FEATURE_USES_QUESTIONS. question_module_uses_questions() should be used to determine
25 if a module uses questions.
26
272) It is sometimes necessary to display bits of question content without having
181393aa
TH
28 and attempt (question_usage) in progress. Two examples of this are the option
29 in the question bank to display the questiontext, and in the quiz statistics
30 report, where it displays the question text above the report.
31
32 Previously, this display was done using a special method that only worked for
33 the question text, but which would not work for other parts of the question.
34 That old mechanism has been deprecated, and there is a new method that you
35 should use.
36
37 To display the question, replace calls to question_rewrite_questiontext_preview_urls
38 with calls to question_rewrite_question_preview_urls. Because the new function
39 is more flexibile, you have to pass more arguments.
40
41 To perform the necessary permission checks when the file is downloaded, you need
42 to implement the callback [component name]_question_preview_pluginfile.
43 (Previously you implemented [component name]_questiontext_preview_pluginfile.)
44 quiz_statistics_question_preview_pluginfile is an example of what to do.
45
46 question_send_questiontext_file has been deprecated. It is no longer necessary.
47
48 To ensure you are no longer using or defining any deprecated functions,
49 search for the regular expression:
50 question_rewrite_questiontext_preview_urls|_questiontext_preview_pluginfile|question_send_questiontext_file
70f22d60 51
c2f35e0b
TH
523) The argument list for core_question_renderer::mark_summary has changed.
53 Please update your calls. (The most likely scenario for this is if you have
54 overridden core_question_renderer::info in your own renderer.) You need to
55 make a change like:
56 - $this->mark_summary($qa, $options);
57 + $this->mark_summary($qa, $behaviouroutput, $options);