MDL-37847 / MDL-38119 question engine: document API change.
[moodle.git] / question / type / upgrade.txt
CommitLineData
78fc17eb
TH
1This files describes API changes for question type plugins.
2
e01cf1fa
TH
3=== 2.3.5 / 2.4.2 / 2.5 ===
4
5* The special value question_attempt::PARAM_CLEANHTML_FILES that could be used
6 in the get_expected_data method was renamed to question_attempt::PARAM_RAW_FILES
7 in order to fix a bug. We failed to think this throught, and so did not realised
8 that this might break some question types. If this affected your question type,
9 please accept our apologies. Details in MDL-37847.
10
11
a031b0f3 12=== 2.3 ===
c2f5e2ab 13
a031b0f3
TH
14* Support for backwards-compatible string names dropped. MDL-30120. (See under 2.2 below.)
15* If you are overriding export_to_xml and import_from_xml to provide Moodle XML format
16 import and export, then you will probably get PHP strict syntax notices in developer
17 debug mode until you change the method signature to include qformat_xml $format.
18 That is, you need to specify the argument type.
7a00d438
DM
19* qtype_xxx_pluginfile() is now given the 7th parameter (hopefully the last
20 one) that contains additional options for the file serving. The array should
21 be re-passed to question_pluginfile() as is.
c2f5e2ab
TH
22
23
78fc17eb
TH
24=== 2.2 ===
25
26* The XML import/export base class has had some minor API changes. The
27 - write_combined_feedback method now requires that you pass the questionid and
28 contextid. (MDL-29058)
29 - calls to the import_hints and import_answer methods now should pass the question
30 text format as the last argument, to be used as a default if necessary. (MDL-29739)
31 If you do not upgrade your code, it will not break, but there will be PHP
32 warnings, and it the export will not work 100% correctly.
33
226b3124
TH
34* The old
35 public function requires_qtypes()
36method is no more. Instead use the ->dependencies facility in version.php. E.g.
37$plugin->dependencies = array(
38 'qtype_numerical' => 2011102700,
39);
40
41* The plugin name and related strings used to be defined in language strings
42called the same thing as the format, for example:
43
44$string['addingdescription'] = 'Adding a Description';
45$string['description'] = 'Description';
46$string['description_help'] = 'A description is not really a question type. It simply enables text to be displayed without requiring any answers, similar to a label on the course page.
47$string['description_link'] = 'A description is not really a question type. It simply enables text to be displayed without requiring any answers, similar to a label on the course page.
48$string['descriptionsummary'] = 'This is not actually a question. Instead it is a way to add some instructions, rubric or other content to the activity. This is similar to the way that labels can be used to add content to the course page.';
49$string['editingdescription'] = 'Editing a Description';
50
51All these need to be changed to use the standard string name pluginname, as for
52other plugin types, and similar for the other strings.
53
54$string['pluginname'] = 'Description';
55$string['pluginname_help'] = 'A description is not really a question type. It simply enables text to be displayed without requiring any answers, similar to a label on the course page.
56$string['pluginname_link'] = 'A description is not really a question type. It simply enables text to be displayed without requiring any answers, similar to a label on the course page.
57$string['pluginnameadding'] = 'Adding a Description';
58$string['pluginnameediting'] = 'Editing a Description';
59$string['pluginnamesummary'] = 'This is not actually a question. Instead it is a way to add some instructions, rubric or other content to the activity. This is similar to the way that labels can be used to add content to the course page.';
60
61The old strings will continue to work, but only until Moodle 2.3 is released.
56565037
VS
62
63* If you are using the facilities provided by overriding the extra_answer_fields
64 or questionid_column_name methods, then you must change these to be public
65 methods. (This is required so that backup and restore can be made to work
66 automatically. MDL-24408, MDL-25617, MDL-30562)
0b94d6bf 67
0b94d6bf 68
a031b0f3
TH
69=== 2.1 ===
70
71* Lots of API changes due to the new question engine. See
72http://docs.moodle.org/dev/Developing_a_Question_Type#Converting_a_Moodle_2.0_question_type
73
74
75=== 2.0 ===
76
77* Lots of changes due to all the API changes in Moodle 2.0.
78
79* This plugin type now supports cron in the standard way. If required, Create a
80 lib.php file containing
81function qtype_mypluginname_cron() {};