Merge branch 'MDL-40662_master' of https://github.com/markn86/moodle
[moodle.git] / question / type / upgrade.txt
CommitLineData
78fc17eb
TH
1This files describes API changes for question type plugins.
2
eca230b5
TH
3=== 2.5 ===
4
dc38c5b4 5* There have been some tweaks to the helper class that is used to write
eca230b5
TH
6 walkthrough tests. You should not have to change your code, but you might
7 like to take a look at some of the new helper methods available. In particular,
8 if you had any code that did
9 $this->process_submission(array('-finish' => 1));
10 you should change that to
11 $this->finish();
dc38c5b4
TH
12
13* There have been lots of usability improvements to the question editing forms.
14 MDL-37417 links to all the changes. There are only a few API changes that
15 *require* you to upgrade your question type, but you are strongly recommended
16 to make similar usability improvements in your own question types.
17
18 + Some of the ids used in the form HTML have had ‘id_’ added at the front.
19 Take care if you refer to these in your JavasSript or CSS.
20
21 + MDL-32750 The HTML editing tools are now collapsed. This is applied by default
22 to all HTML editors except question text and general feedback. If you want to
23 add more exceptions, see the get_non_collabsible_editor_options method.
24
25 + Form fields have been grouped onto one line where appropriate, to reduce
26 the height of the form. qtype_numerical is a good example of this.
27
28 + Where elements are in groups, we have changed the normal accesshide CSS, so
29 that their labels are visible. If you were using grouped elements in the past
30 with static elements to lable the fields, then you will need to remove the statics.
31
32 + All the choices / answers have been merged into a single section of the form.
33 This works better with the new 'shortforms' MDL-30637. Also the
34 "Add blanks for more ..." buttons are now inside that section. This probably
35 requries that you remove any headings from your per-answer fields, and change
36 some of the labels.
37
38 + Having merged all the elements into one form section, we then used CSS to
39 visually group the fields for one choice, answer, etc.
40
41 + When editing an existing question, we only show as many repeats are are
42 actually needed until the user clicks the "Add blanks for more ..." button.
43 Where you have your own repeat elements, you may need to change the
44 number of repeats calculation.
45
46 + As with all forms, setType() is now required for all text form elements.
47
48 + A good example of a question type being upgraded to take account of all these
49 changes is
50 https://github.com/moodleou/moodle-qtype_pmatch/commit/9d8e1beb9f780246416a0f3a7622f700b8fa90c8
51
eca230b5 52
e01cf1fa
TH
53=== 2.3.5 / 2.4.2 / 2.5 ===
54
55* The special value question_attempt::PARAM_CLEANHTML_FILES that could be used
56 in the get_expected_data method was renamed to question_attempt::PARAM_RAW_FILES
57 in order to fix a bug. We failed to think this throught, and so did not realised
58 that this might break some question types. If this affected your question type,
59 please accept our apologies. Details in MDL-37847.
60
61
a031b0f3 62=== 2.3 ===
c2f5e2ab 63
a031b0f3
TH
64* Support for backwards-compatible string names dropped. MDL-30120. (See under 2.2 below.)
65* If you are overriding export_to_xml and import_from_xml to provide Moodle XML format
66 import and export, then you will probably get PHP strict syntax notices in developer
67 debug mode until you change the method signature to include qformat_xml $format.
68 That is, you need to specify the argument type.
7a00d438
DM
69* qtype_xxx_pluginfile() is now given the 7th parameter (hopefully the last
70 one) that contains additional options for the file serving. The array should
71 be re-passed to question_pluginfile() as is.
c2f5e2ab
TH
72
73
78fc17eb
TH
74=== 2.2 ===
75
76* The XML import/export base class has had some minor API changes. The
77 - write_combined_feedback method now requires that you pass the questionid and
78 contextid. (MDL-29058)
79 - calls to the import_hints and import_answer methods now should pass the question
80 text format as the last argument, to be used as a default if necessary. (MDL-29739)
81 If you do not upgrade your code, it will not break, but there will be PHP
82 warnings, and it the export will not work 100% correctly.
83
226b3124
TH
84* The old
85 public function requires_qtypes()
86method is no more. Instead use the ->dependencies facility in version.php. E.g.
87$plugin->dependencies = array(
88 'qtype_numerical' => 2011102700,
89);
90
91* The plugin name and related strings used to be defined in language strings
92called the same thing as the format, for example:
93
94$string['addingdescription'] = 'Adding a Description';
95$string['description'] = 'Description';
96$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.
97$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.
98$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.';
99$string['editingdescription'] = 'Editing a Description';
100
101All these need to be changed to use the standard string name pluginname, as for
102other plugin types, and similar for the other strings.
103
104$string['pluginname'] = 'Description';
105$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.
106$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.
107$string['pluginnameadding'] = 'Adding a Description';
108$string['pluginnameediting'] = 'Editing a Description';
109$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.';
110
111The old strings will continue to work, but only until Moodle 2.3 is released.
56565037
VS
112
113* If you are using the facilities provided by overriding the extra_answer_fields
114 or questionid_column_name methods, then you must change these to be public
115 methods. (This is required so that backup and restore can be made to work
116 automatically. MDL-24408, MDL-25617, MDL-30562)
0b94d6bf 117
0b94d6bf 118
a031b0f3
TH
119=== 2.1 ===
120
121* Lots of API changes due to the new question engine. See
122http://docs.moodle.org/dev/Developing_a_Question_Type#Converting_a_Moodle_2.0_question_type
123
124
125=== 2.0 ===
126
127* Lots of changes due to all the API changes in Moodle 2.0.
128
129* This plugin type now supports cron in the standard way. If required, Create a
130 lib.php file containing
131function qtype_mypluginname_cron() {};