MDL-40313 Fix code and doc checker warnings.
[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
8 pluggable question_bank_search_condition classes.
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
14 protected function display_category_form() is deprecated. Use question_bank_search_condition_category
15
16 protected function display_category_form_checkbox deprecated use html_writer::checkbox and separate Javascript
17
18To add filters, local plugins can now implement the function local_[pluginname]_get_question_bank_search_conditions,
19
181393aa
TH
20=== 2.6 ===
21
b07ef13b
DP
221) Modules using the question bank MUST now declare their use of it with the xxx_supports()
23 flag FEATURE_USES_QUESTIONS. question_module_uses_questions() should be used to determine
24 if a module uses questions.
25
262) It is sometimes necessary to display bits of question content without having
181393aa
TH
27 and attempt (question_usage) in progress. Two examples of this are the option
28 in the question bank to display the questiontext, and in the quiz statistics
29 report, where it displays the question text above the report.
30
31 Previously, this display was done using a special method that only worked for
32 the question text, but which would not work for other parts of the question.
33 That old mechanism has been deprecated, and there is a new method that you
34 should use.
35
36 To display the question, replace calls to question_rewrite_questiontext_preview_urls
37 with calls to question_rewrite_question_preview_urls. Because the new function
38 is more flexibile, you have to pass more arguments.
39
40 To perform the necessary permission checks when the file is downloaded, you need
41 to implement the callback [component name]_question_preview_pluginfile.
42 (Previously you implemented [component name]_questiontext_preview_pluginfile.)
43 quiz_statistics_question_preview_pluginfile is an example of what to do.
44
45 question_send_questiontext_file has been deprecated. It is no longer necessary.
46
47 To ensure you are no longer using or defining any deprecated functions,
48 search for the regular expression:
49 question_rewrite_questiontext_preview_urls|_questiontext_preview_pluginfile|question_send_questiontext_file