MDL-40069 Document editing form changes
[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
5* There have been some tweaks to the helper class that is used to right
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();
e6865167
CC
12
13For MDL-37417 Question editing form improvements several improvements were made. Including:
14* MDL -32750 Introduced collapsible editor. Editors now collapsed by default in editor options.
15 Helper method get_non_collabsible_editor_options()
16* To use screen real estate better related elements were grouped using form grouping where
17 possible. Particularly answers/choices.
18* Changed access hide style for elements in group so their labels are visible and related
19 static elements could be removed.
20* Add blanks for more repeated elements were made part of the relevant section by adding
21 true as the final parameter of the call to repeat_elements();
22* More repeated elements should only be added when requested
eca230b5 23
e6865167
CC
24* Style is used to visually group field elements. Including choices/answer and multiple tries/hints
25* The new collapsible sections has changed the ids of the headers by adding ‘id_’. This caused
26 javascript errors. Adjusted references to in javascript and css.
27* setType() is now required for repeated form elements.
28* The plugin version was changed. These changes are not backward compatible. They require moodle 2.5
29
30A reference example of these changes is
31https://github.com/moodleou/moodle-qtype_pmatch/commit/9d8e1beb9f780246416a0f3a7622f700b8fa90c8
eca230b5 32
e01cf1fa
TH
33=== 2.3.5 / 2.4.2 / 2.5 ===
34
35* The special value question_attempt::PARAM_CLEANHTML_FILES that could be used
36 in the get_expected_data method was renamed to question_attempt::PARAM_RAW_FILES
37 in order to fix a bug. We failed to think this throught, and so did not realised
38 that this might break some question types. If this affected your question type,
39 please accept our apologies. Details in MDL-37847.
40
41
a031b0f3 42=== 2.3 ===
c2f5e2ab 43
a031b0f3
TH
44* Support for backwards-compatible string names dropped. MDL-30120. (See under 2.2 below.)
45* If you are overriding export_to_xml and import_from_xml to provide Moodle XML format
46 import and export, then you will probably get PHP strict syntax notices in developer
47 debug mode until you change the method signature to include qformat_xml $format.
48 That is, you need to specify the argument type.
7a00d438
DM
49* qtype_xxx_pluginfile() is now given the 7th parameter (hopefully the last
50 one) that contains additional options for the file serving. The array should
51 be re-passed to question_pluginfile() as is.
c2f5e2ab
TH
52
53
78fc17eb
TH
54=== 2.2 ===
55
56* The XML import/export base class has had some minor API changes. The
57 - write_combined_feedback method now requires that you pass the questionid and
58 contextid. (MDL-29058)
59 - calls to the import_hints and import_answer methods now should pass the question
60 text format as the last argument, to be used as a default if necessary. (MDL-29739)
61 If you do not upgrade your code, it will not break, but there will be PHP
62 warnings, and it the export will not work 100% correctly.
63
226b3124
TH
64* The old
65 public function requires_qtypes()
66method is no more. Instead use the ->dependencies facility in version.php. E.g.
67$plugin->dependencies = array(
68 'qtype_numerical' => 2011102700,
69);
70
71* The plugin name and related strings used to be defined in language strings
72called the same thing as the format, for example:
73
74$string['addingdescription'] = 'Adding a Description';
75$string['description'] = 'Description';
76$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.
77$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.
78$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.';
79$string['editingdescription'] = 'Editing a Description';
80
81All these need to be changed to use the standard string name pluginname, as for
82other plugin types, and similar for the other strings.
83
84$string['pluginname'] = 'Description';
85$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.
86$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.
87$string['pluginnameadding'] = 'Adding a Description';
88$string['pluginnameediting'] = 'Editing a Description';
89$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.';
90
91The old strings will continue to work, but only until Moodle 2.3 is released.
56565037
VS
92
93* If you are using the facilities provided by overriding the extra_answer_fields
94 or questionid_column_name methods, then you must change these to be public
95 methods. (This is required so that backup and restore can be made to work
96 automatically. MDL-24408, MDL-25617, MDL-30562)
0b94d6bf 97
0b94d6bf 98
a031b0f3
TH
99=== 2.1 ===
100
101* Lots of API changes due to the new question engine. See
102http://docs.moodle.org/dev/Developing_a_Question_Type#Converting_a_Moodle_2.0_question_type
103
104
105=== 2.0 ===
106
107* Lots of changes due to all the API changes in Moodle 2.0.
108
109* This plugin type now supports cron in the standard way. If required, Create a
110 lib.php file containing
111function qtype_mypluginname_cron() {};