Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Moodle 2.0 question type API changes: Difference between revisions

From MoodleDocs
(New page: This is probably incomplete, and will probably change more before Moodle 2.0 is released, but hopefully it is better than nothing. ==Language strings== For the last several versions, we ...)
 
No edit summary
Line 11: Line 11:
Most question types should not need to override the save_question method, however ...
Most question types should not need to override the save_question method, however ...
In Moodle 1.9, it was necessary to do complex processing on the combination $form->category and $form->categorymoveto. This is now handled by question/question.php, and save_question need only use the $form->category. (This change was actually in Moodle 1.9.5. )  
In Moodle 1.9, it was necessary to do complex processing on the combination $form->category and $form->categorymoveto. This is now handled by question/question.php, and save_question need only use the $form->category. (This change was actually in Moodle 1.9.5. )  
==New question type administration page==
The old get_config_options method has been removed. I don't think any question types were using it.
Instead question types can have a [[Admin_settings|settings.php file]] like other types of plugins. Please put your settings in config_plugins, under plugin name 'qtype_xxx'. MDL-16407


==New metadata methods==
==New metadata methods==

Revision as of 07:31, 23 February 2009

This is probably incomplete, and will probably change more before Moodle 2.0 is released, but hopefully it is better than nothing.

Language strings

For the last several versions, we have provided legacy support for question types with language strings in the quiz.php language file. That support is now gone. You should have a proper qtype_xxx.php language file for your question type. Similarly for help files.

As a result, the get_heading method has had its signature changed. MDL-18350.

How the category parameter is passed to save_question

Most question types should not need to override the save_question method, however ... In Moodle 1.9, it was necessary to do complex processing on the combination $form->category and $form->categorymoveto. This is now handled by question/question.php, and save_question need only use the $form->category. (This change was actually in Moodle 1.9.5. )

New question type administration page

The old get_config_options method has been removed. I don't think any question types were using it.

Instead question types can have a settings.php file like other types of plugins. Please put your settings in config_plugins, under plugin name 'qtype_xxx'. MDL-16407

New metadata methods

Most of these you should not have to change, because the base class implementation should be fine. Please read the PHPdoc comments for further details.

  • plugin_name - can be used in get_string calls. MDL-18350
  • is_real_question_type - used on the new addquestion.php script, so non-question-types can be shown separately in the UI.
  • requires_qtypes - used by the qtypes admin screen. MDL-6751
  • is_question_manual_graded MDL-8648

See also