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

Add better control to features a module can support

XMLWordPrintable

    • MOODLE_400_STABLE
    • master_MDL-71769-module_control_feature
    • 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.  

      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)

            mattp@catalyst-au.net Matt Porritt
            guillermogomez@catalyst-au.net Guillermo Gomez Arias
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

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