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

Add hooks (instead of callbacks) to extend course edit form

    XMLWordPrintable

Details

    • MOODLE_401_STABLE
    • MOODLE_404_STABLE
    • MDL-73483-master
    • Hide
      1. Install helper plugin https://github.com/dmitriim/moodle-local_helper (git clone https://github.com/dmitriim/moodle-local_helper.git local/helper)
      2. Navigate to /admin/hooks.php and confirm you see new hooks in the list (core_course\hook\after_form_definition, core_course\hook\after_form_definition_after_data, core_course\hook\after_form_submission and core_course\hook\after_form_validation)
      3. Confirm each of the hooks has associated callbacks from local_helper.
      4. Navigate to /course/management.php and click Create a new course button.
      5. Confirm you can see "New course is being created" info banner as well as  "Save to Course ID number" text field.
      6.  Populate course full name, course short name, category, but leave "Save to Course ID number" empty and try to submit the form.
      7. Confirm you see an error "This value can not be empty" related to "Save to Course ID number"  text field.
      8. Populate the field with "Test value" and save and display the form.  Confirm it went past validation.
      9. Click on Settings and bring up the course form again. Confirm you see "A course is being updated" info banner.
      10. Confirm "Test value" saved to "Course ID number" field.
      11. Remove a value of "Save to Course ID number"  field and try to submit the form.  Confirm you see an error "This value can not be empty" related to the actual "Course ID number"  text field.
      12. Populate "Save to Course ID number"  with "New test value". Click Save and display and then back to course settings.
      13. Confirm "New test value" saved to  "Course ID number".
      Show
      Install helper plugin https://github.com/dmitriim/moodle-local_helper (git clone https://github.com/dmitriim/moodle-local_helper.git local/helper) Navigate to /admin/hooks.php and confirm you see new hooks in the list (core_course\hook\after_form_definition, core_course\hook\after_form_definition_after_data, core_course\hook\after_form_submission and core_course\hook\after_form_validation) Confirm each of the hooks has associated callbacks from local_helper. Navigate to /course/management.php and click Create a new course button. Confirm you can see "New course is being created" info banner as well as  "Save to Course ID number" text field.  Populate course full name, course short name, category, but leave "Save to Course ID number" empty and try to submit the form. Confirm you see an error "This value can not be empty" related to "Save to Course ID number"  text field. Populate the field with "Test value" and save and display the form.  Confirm it went past validation. Click on Settings and bring up the course form again. Confirm you see "A course is being updated" info banner. Confirm "Test value" saved to "Course ID number" field. Remove a value of "Save to Course ID number"  field and try to submit the form.  Confirm you see an error "This value can not be empty" related to the actual "Course ID number"  text field. Populate "Save to Course ID number"  with "New test value". Click Save and display and then back to course settings. Confirm "New test value" saved to  "Course ID number".

    Description

      There're already callbacks (coursemodule_edit_post_actions, coursemodule_standard_elements and coursemodule_validation) that enables us to extend the form for modules. It would be great to have additional PSR hooks to extend the course and course category edit forms.

      Attachments

        1. (1) 10 Passed -- (Main)MDL-73483.png
          27 kB
          Kim Jared Lucas
        2. (1) 11 Passed -- (Main)MDL-73483.png
          31 kB
          Kim Jared Lucas
        3. (1) 13 Passed -- (Main)MDL-73483.png
          28 kB
          Kim Jared Lucas
        4. (1) 2 Passed -- (Main)MDL-73483.png
          95 kB
          Kim Jared Lucas
        5. (1) 3 Passed -- (Main)MDL-73483.png
          53 kB
          Kim Jared Lucas
        6. (1) 5 Passed -- (Main)MDL-73483.png
          14 kB
          Kim Jared Lucas
        7. (1) 7 Passed -- (Main)MDL-73483.png
          18 kB
          Kim Jared Lucas
        8. (1) 8 Passed -- (Main)MDL-73483.png
          45 kB
          Kim Jared Lucas
        9. (1) 9 Passed -- (Main)MDL-73483.png
          18 kB
          Kim Jared Lucas

        Issue Links

          Activity

            People

              dmitriim Dmitrii Metelkin
              mstimvol Tim Volckmann
              Brendan Heywood Brendan Heywood
              Jun Pataleta Jun Pataleta
              Kim Jared Lucas Kim Jared Lucas
              Votes:
              4 Vote for this issue
              Watchers:
              26 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 6 hours, 10 minutes
                  6h 10m

                  Clockify

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