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

API enhancement: Way to prevent modules appearing on 'Add...' dropdowns

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.3
    • 2.3
    • Course
    • MOODLE_23_STABLE
    • MOODLE_23_STABLE
    • MDL-30408-master
    • Hide

      function oucontent_get_types() {
          // This prevents it being on the Add Activity menu
          return array();
      }

      Show
      function oucontent_get_types() { // This prevents it being on the Add Activity menu return array(); }
    • Hide

      Level: DIFFICULT (needs code access).

      0. If necessary, turn on the restrict modules feature for all courses.

      1. Load a course page. Turn editing on. Select an 'Add a resource...' dropdown.
      + Verify that the URL module is included on the list.

      2. Add a URL (any settings).

      3. Edit mod/url/lib.php. Change the line in url_supports, 'return MOD_ARCHETYPE_RESOURCE' to return MOD_ARCHETYPE_SYSTEM.

      4. Reload the course page.
      + Verify that the URL module now does not appear on the list.
      + Verify that the existing URL still appears and can still be edited.

      5. Edit course settings.
      + Verify that the URL module now is not listed on the 'restrict modules' list (there's no point as you cannot add it there anyhow)
      + Verify that the 'restrict modules' list shows the human-readable names of each module not the lower-case codes (Forum vs. forum)

      Show
      Level: DIFFICULT (needs code access). 0. If necessary, turn on the restrict modules feature for all courses. 1. Load a course page. Turn editing on. Select an 'Add a resource...' dropdown. + Verify that the URL module is included on the list. 2. Add a URL (any settings). 3. Edit mod/url/lib.php. Change the line in url_supports, 'return MOD_ARCHETYPE_RESOURCE' to return MOD_ARCHETYPE_SYSTEM. 4. Reload the course page. + Verify that the URL module now does not appear on the list. + Verify that the existing URL still appears and can still be edited. 5. Edit course settings. + Verify that the URL module now is not listed on the 'restrict modules' list (there's no point as you cannot add it there anyhow) + Verify that the 'restrict modules' list shows the human-readable names of each module not the lower-case codes (Forum vs. forum)

      (Change proposed for 2.3, please ignore until that starts.)

      In several cases at the OU we have modules which you cannot create using the normal 'Add a resource/activity' dropdowns. This is because either:

      a) the creation process is complicated and must be initiated within another system
      or
      b) the module is created by the system automatically independent of user

      To support these I propose adding a fourth ARCHETYPE constant: MOD_ARCHETYPE_SYSTEM for modules which can only be added by the system and do not appear in the list.

      There is a hack to do this in current (including 2.2) system but it is horrible and seems likely to die in future, now that assignment module has done. See workaround below.

      In addition while implementing this feature I observed that the 'restrict modules' list uses the internal names for modules (e.g. 'forum') rather than the translated language strings. This seems bizarre, so I fixed it.

            quen Sam Marshall
            quen Sam Marshall
            Tim Hunt Tim Hunt
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Aparup Banerjee Aparup Banerjee
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

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