weekly release 2.7dev
[moodle.git] / question / behaviour / upgrade.txt
CommitLineData
75a31c90
TH
1This files describes API changes for question behaviour plugins.
2
06616f4b
TH
3=== 2.6 ===
4
51) Legacy required_question_definition_type no longer supported. (See 2.2 point 2) below.)
6
f3460297
TH
72) Behaviours now have to define an extra class
8class qbehaviour_mybehaviour_type extends question_behaviour_type {
9 This class returns information about the type of behaviour, as opposed to
10 the qbehaviour_mybehaviour class which controls a particular
11 question_attempt. That is like the difference between the qtype_mytype and
12 the qtype_mytype_question classes.
13
02d3e4d5
TH
14 Practically, what this means is that any of the methods that used to be
15 static methods of qbehaviour_mybehaviour class are now normal instance
16 methods of the qbehaviour_mybehaviour_type class. Specifically.
f3460297
TH
17 2.5 / qbehaviour_mybehaviour -> 2.6 / qbehaviour_mybehaviour_type
18 IS_ARCHETYPAL -> is_archetypal()
19 adjust_random_guess_score() -> adjust_random_guess_score()
20 get_unused_display_options() -> get_unused_display_options()
21
02d3e4d5 223) The static method is_manual_grade_in_range has moved from the
f3460297
TH
23 question_behaviour class to the question_engine class.
24
02d3e4d5
TH
254) Behaviours can now control how the marks information is displayed in the
26 grey info area to the left of the question. There is a new method
27 mark_summary that you can override, although the default implementation is
28 fine in most cases. it uses the marked_out_of_max and mark_out_of_max methods
29 as appropriate, so you may just wish to override those.
30
f3460297 31
054124a3
DP
32=== 2.3 ===
33
06616f4b
TH
341) This plugin type now supports cron in the standard way. If required, Create a
35 lib.php file containing
054124a3
DP
36function qbehaviour_mypluginname_cron() {};
37
f3460297 38
75a31c90
TH
39=== 2.2 ===
40
3d17cd3f 411) The old
75a31c90 42 public static function get_required_behaviours()
f3460297 43 method is no more. Instead use the ->dependencies facility in version.php. E.g.
75a31c90
TH
44$plugin->dependencies = array(
45 'qbehaviour_immediatefeedback' => 2011102700,
46 'qbehaviour_deferredcbm' => 2011102700
47);
3d17cd3f
TH
48
492) The old required_question_definition_type method has been replaced by a new
f3460297
TH
50 is_compatible_question method. You should change your behaviour to override
51 the new method, not the old one. This change has been implemented in a
52 backwards-compatible way, so behaviours will not break.