Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-78710

Simplify question form and import handling code

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 4.2.1
    • Questions
    • None

      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.

            Unassigned Unassigned
            marxjohnson Mark Johnson
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.