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

Allow "locked" and "advanced" checkboxes to be added to any admin setting.

    XMLWordPrintable

Details

    • MOODLE_25_STABLE
    • MOODLE_26_STABLE
    • MDL-37459-master
    • Hide
      1. This change should have no effect on existing module forms because it only adds the functions but does not use them in any modules (see linked issues for implementations).
      2. So testing requires:
      3. Viewing the admin settings forms for quiz and verifying that the settings can be updated and saved with no errors
      4. Viewing the activity settings forms for a few different activities including assignment and quiz and verifying there are no errors when viewing/saving.
      Show
      This change should have no effect on existing module forms because it only adds the functions but does not use them in any modules (see linked issues for implementations). So testing requires: Viewing the admin settings forms for quiz and verifying that the settings can be updated and saved with no errors Viewing the activity settings forms for a few different activities including assignment and quiz and verifying there are no errors when viewing/saving.

    Description

      This patch moves the implementation of the "advanced" and "locked" checkboxes for admin_settings to the base class - so any admin setting can use these flags. The current implementations of blah_with_advanced and blah_with_lock have been converted into wrappers which just set the flags on the base class.

      This allows any setting to use any combination of locked or advanced checkboxes and makes it easier to add new ones (hidden might be nice...).

      This change is 100% backward compatible and does not require any changes to existing subclasses of admin_settings.

      To enable an advanced checkbox - call $setting->set_advanced(true);
      To enable an locked checkbox - call $setting->set_lockable(true);

      To set the defaults for the checkboxes call

      $setting->set_advanced_flag_options(admin_setting::OPTION_ENABLED, true);
      or
      $setting->set_locked_flag_options(admin_setting::OPTION_ENABLED, false);

      Note: All modules will work with this patch with 0 changes - the config values set have the same names as the previous implementations.

      Discussion link:
      https://moodle.org/mod/forum/discuss.php?d=220263

      Attachments

        Issue Links

          Activity

            People

              damyon Damyon Wiese
              damyon Damyon Wiese
              Dan Poltawski Dan Poltawski
              Marina Glancy Marina Glancy
              Petr Skoda Petr Skoda
              Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              9 Vote for this issue
              Watchers:
              16 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                18/Nov/13