on-demand release 3.8dev+
[moodle.git] / question / type / upgrade.txt
1This files describes API changes for question type plugins.
3=== 3.8, 3.7.3, 3.6.7 ===
5* Coming up in Moodle 3.8 are some changes to the question bank UI. These will break any
6 Behat automated tests which use the common pattern
7 When I click on "Duplicate" "link" in the "Test question" "table_row"
8 to trigger actions on questions when looking at the question bank screen. Therefore,
9 a new step has been introduced:
10 When I choose "Duplicate" action for "Test question" in the question bank
11 If you want your Behat tests to continue working with Moodle 3.8, you will need to use
12 the new step. The new step has been back-ported, so you can start updating your tests
13 and have them work with Moodle 3.6 and 3.7. In addition, if you want to trigger the
14 "Edit" action, you should change that to "Edit question".
94cb5a66 17=== 3.5 ===
9c14b28d 18
19 + Added new classes backup_qtype_extrafields_plugin and restore_qtype_extrafields_plugin
20 in order to use extra fields method in backup/restore question type. Require and inherit new classes for using it. See
21 backup_qtype_shortanswer_plugin and restore_qtype_shortanswer_plugin for an example of using this.
22 + The declaration of is_gradable_response has been moved from question_automatically_gradable to
23 question_manually_gradable.
24 + The default implementation of is_gradable_response has been moved from question_graded_automatically to
25 question_with_responses.
26 + Note that format_text() is no longer applied to the results of
27 qtype_elements_embedded_in_question_text_renderer::embedded_element(). If question type overrides
28 this method make sure you apply format_text() to any text that came from a user.
5a8d683f 29
30=== 3.1.5, 3.2.2, 3.3 ===
32* If you are using check_combined_feedback_file_access in your check_file_access method,
33 then you must now pass $args as the 4th argument, so the correct permission checks
34 can be performed. If you don't, you will get a developer debug notice.
36=== 3.1 ===
38* The following functions, previously used (exclusively) by upgrade steps are not available
39 anymore because of the upgrade cleanup performed for this version. See MDL-51580 for more info:
40 - qtype_essay_convert_to_html()
42=== 2.7 ===
43 + We have added a new method to the question_type base class 'break_down_stats_and_response_analysis_by_variant'. By default it
44 returns true. If your question type does not have variants of question instances then you can ignore this method as it only
45 applies to question types that have variants. If a question type does have variants the default action is to break down
46 response analysis and question stats by variant. But for some question types there might be an almost infinite quantity of
47 variants for the question, in this case you can suppress break down by variant by returning false from this method. See for
48 example the non-core question type varnumeric or the slightly more complex stack question type.
49 + We have added a pair of methods to the question_definition class 'prepare_simulated_post_data' and
50 'get_student_response_values_for_simulation'. You may want to override these methods in question.php in your question type plug
51 -in. These methods are used to convert data from a csv file of simulated step data into the simulated post data that is fed
52 to the question engine. These csv files can be used for unit testing or manual testing the use of your question type within the
53 quiz module. You can use the simulate quiz report for manual testing and also to easily generate csv test files. You can
54 run a number of students through a test and then download a csv file representing their interaction with the quiz. For most
55 question types the default of just passing csv data as post data, directly from the csv file will probably work fine. But for
56 certain question types where the meaning of the post data is deliberately obfuscated it might be necessary to convert from a
57 human friendly format in the csv file to response data expected by the question type using 'prepare_simulated_post_data' and
58 to convert back from a question type response array to values for download in a csv file using
59 'get_student_response_values_for_simulation'.
60=== 2.6 ===
61 + The changes in MDL-32750 were reverted in favour of the new pdw toggle toolbars
62 plugin for TinyMCE. The get_non_collapsible_editor_options method has been deprecated.
64=== 2.5 ===
dc38c5b4 66* There have been some tweaks to the helper class that is used to write
67 walkthrough tests. You should not have to change your code, but you might
68 like to take a look at some of the new helper methods available. In particular,
69 if you had any code that did
70 $this->process_submission(array('-finish' => 1));
71 you should change that to
72 $this->finish();
74* There have been lots of usability improvements to the question editing forms.
75 MDL-37417 links to all the changes. There are only a few API changes that
76 *require* you to upgrade your question type, but you are strongly recommended
77 to make similar usability improvements in your own question types.
79 + Some of the ids used in the form HTML have had ‘id_’ added at the front.
80 Take care if you refer to these in your JavasSript or CSS.
82 + MDL-32750 The HTML editing tools are now collapsed. This is applied by default
83 to all HTML editors except question text and general feedback. If you want to
84 add more exceptions, see the get_non_collabsible_editor_options method.
86 + Form fields have been grouped onto one line where appropriate, to reduce
87 the height of the form. qtype_numerical is a good example of this.
89 + Where elements are in groups, we have changed the normal accesshide CSS, so
90 that their labels are visible. If you were using grouped elements in the past
91 with static elements to lable the fields, then you will need to remove the statics.
93 + All the choices / answers have been merged into a single section of the form.
94 This works better with the new 'shortforms' MDL-30637. Also the
95 "Add blanks for more ..." buttons are now inside that section. This probably
96 requries that you remove any headings from your per-answer fields, and change
97 some of the labels.
99 + Having merged all the elements into one form section, we then used CSS to
100 visually group the fields for one choice, answer, etc.
102 + When editing an existing question, we only show as many repeats are are
103 actually needed until the user clicks the "Add blanks for more ..." button.
104 Where you have your own repeat elements, you may need to change the
105 number of repeats calculation.
107 + As with all forms, setType() is now required for all text form elements.
109 + A good example of a question type being upgraded to take account of all these
110 changes is
111 https://github.com/moodleou/moodle-qtype_pmatch/commit/9d8e1beb9f780246416a0f3a7622f700b8fa90c8
eca230b5 113
114=== 2.3.5 / 2.4.2 / 2.5 ===
116* The special value question_attempt::PARAM_CLEANHTML_FILES that could be used
117 in the get_expected_data method was renamed to question_attempt::PARAM_RAW_FILES
118 in order to fix a bug. We failed to think this throught, and so did not realised
119 that this might break some question types. If this affected your question type,
120 please accept our apologies. Details in MDL-37847.
a031b0f3 123=== 2.3 ===
c2f5e2ab 124
125* Support for backwards-compatible string names dropped. MDL-30120. (See under 2.2 below.)
126* If you are overriding export_to_xml and import_from_xml to provide Moodle XML format
127 import and export, then you will probably get PHP strict syntax notices in developer
128 debug mode until you change the method signature to include qformat_xml $format.
129 That is, you need to specify the argument type.
130* qtype_xxx_pluginfile() is now given the 7th parameter (hopefully the last
131 one) that contains additional options for the file serving. The array should
132 be re-passed to question_pluginfile() as is.
135=== 2.2 ===
137* The XML import/export base class has had some minor API changes. The
138 - write_combined_feedback method now requires that you pass the questionid and
139 contextid. (MDL-29058)
140 - calls to the import_hints and import_answer methods now should pass the question
141 text format as the last argument, to be used as a default if necessary. (MDL-29739)
142 If you do not upgrade your code, it will not break, but there will be PHP
143 warnings, and it the export will not work 100% correctly.
145* The old
146 public function requires_qtypes()
147method is no more. Instead use the ->dependencies facility in version.php. E.g.
148$plugin->dependencies = array(
149 'qtype_numerical' => 2011102700,
152* The plugin name and related strings used to be defined in language strings
153called the same thing as the format, for example:
155$string['addingdescription'] = 'Adding a Description';
156$string['description'] = 'Description';
157$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.
158$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.
159$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.';
160$string['editingdescription'] = 'Editing a Description';
162All these need to be changed to use the standard string name pluginname, as for
163other plugin types, and similar for the other strings.
165$string['pluginname'] = 'Description';
166$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.
167$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.
168$string['pluginnameadding'] = 'Adding a Description';
169$string['pluginnameediting'] = 'Editing a Description';
170$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.';
172The old strings will continue to work, but only until Moodle 2.3 is released.
174* If you are using the facilities provided by overriding the extra_answer_fields
175 or questionid_column_name methods, then you must change these to be public
176 methods. (This is required so that backup and restore can be made to work
177 automatically. MDL-24408, MDL-25617, MDL-30562)
0b94d6bf 178
0b94d6bf 179
180=== 2.1 ===
182* Lots of API changes due to the new question engine. See
186=== 2.0 ===
188* Lots of changes due to all the API changes in Moodle 2.0.
190* This plugin type now supports cron in the standard way. If required, Create a
191 lib.php file containing
192function qtype_mypluginname_cron() {};