-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
4.2.1
-
None
-
MOODLE_402_STABLE
As described in MDL-78520 we currently have a lot of code duplication between the question edit form handling and the question import handling code. The question data structure documentation suggests that the data should be in the same format in both cases, but currently there are minor differences. All this means more code to maintain for no good reason.
The question edit form also lacks the extensibility for qbank plugins to define and handle their own fields. There is currently hard-coded functionality for qbank_customfields and qbank_tags, but this lives outside of the plugins and cannot be used by other plugins.
The following changes should be made:
- Modify the definition for the edit_question_form to allow any qbank plugin to define additional fields. This includes adding a function to plugin_feature_base to give plugins a mechanism to define their fields, and implementing this in qbank_customfields.
- Modify the form handling code to process all submitted data in question_type::save_question(). This includes calling data_mapper::save_question_data() (MDL-78520) for each plugin that saves additional data. (Or, do this first then refactor that code)
- Remove the duplicated code in qformat_default::importprocess() by formatting the $question object to match the $fromform parameter of question_type::save_question() and using that to save the data.
- is blocked by
-
MDL-78520 Question import/export formats (e.g. XML) do not include extra data from the question bank (e.g. custom field values)
-
- Reopened
-
- will be (partly) resolved by
-
MDL-78828 Add plugin hooks to question editing process
-
- Closed
-
- will help resolve
-
MDL-73146 Introduce a proper API for the question bank so other plugins don't need to directly reference qbank_ plugins
-
- Open
-