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

Add better control to features a module can support

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Waiting for peer review
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 4.0
    • Fix Version/s: None
    • Component/s: Other
    • Testing Instructions:
      Hide

      For existing Moodle core module plugins and third party and community plugins there should be no change in functionality.

      The features on the module add/edit form should not change for existing core modules when this patch is added.

      The mod_qbank activity in MDL-71378  is an example of a plugin that uses this new functionality.

       

      Show
      For existing Moodle core module plugins and third party and community plugins there should be no change in functionality. The features on the module add/edit form should not change for existing core modules when this patch is added. The mod_qbank activity in MDL-71378   is an example of a plugin that uses this new functionality.  
    • Affected Branches:
      MOODLE_400_STABLE
    • Pull Master Branch:
      master_MDL-71769-module_control_feature

      Description

      Add missing features that can be controlled when adding a new module to core here: https://github.com/moodle/moodle/blob/master/course/moodleform_mod.php#L200

      Module plugins can define which core features they support. However, not every feature can be disabled/enabled. This patch provides greater definition to which features a module plugin supports.

      Current defaults are unchanged.

      Feature control added for:

      • Completion
      • Availability 
      • Access restriction
      • Competencies

      Steps to test:

      1. Install the attached mod_test plugin in your test environment.
      2. Create a test course.
      3. Add the new activity test.
      4. In the /course/modedit.php view you will not be able to see the availability, completion, restriction and competencies options.
      5. You can enable or disable features to test this plugin here: mod/test/lib.php test_supports function:

      function test_supports($feature) {
          switch ($feature) {
              case FEATURE_MOD_INTRO:
                  return true;
              case FEATURE_AVAILABILITY:
              case FEATURE_COMPLETION:
              case FEATURE_RESTRICTIONS:
              case FEATURE_COMPETENCIES:
                  return false;
              default:
                  return null;
          }
      }
      

      Also, Update features in existing module. (to do this update the function modulename_supports($feature) { in the lib.php file)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mattp@catalyst-au.net Matt Porritt
              Reporter:
              guillermogomez@catalyst-au.net Guillermo Gomez Arias
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated: