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

Make admin settings work better with the cnfig_plugins table

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Administration
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      We are trying to encourage plugin writers to use the config_plugins table more. Here is one thing standing in the way:

      To add an admin setting that stores its value in the config table, you need to do

      $temp->add(new admin_setting_configtext('allowemailaddresses', ...

      for a setting that should go in config_plugins, you need.

      $maxgradesetting = new admin_setting_configtext('maximumgrade', ...
      $maxgradesetting->plugin = 'quiz';
      $quizsettings->add($maxgradesetting);

      It's not the end of the world, but it is a pain. So, what to do about it. I see 2 options:

      1. Add an optional parameter to the admin_setting constructor to take a $plugin name that defaults to null. This would be awkward, becuase it woudl have to become the 5th parameter, which is a long way from the variable name, which is the first parameter. Also, adding a setting to the constructor involves changing the constructor of every single admin setting subclass.

      2. Change the interpretation of the first paramter, so that you can do

      $temp->add(new admin_setting_configtext('quiz/maximumgrade', ...

      then in the admin setting base class, if the setting name contains a '/', parse it into the plugin name and the setting name.

      I don't insist on '/'. '.' or ':' might be better. The only one we can't use is '_' becuase some admin settings already have an underscore in them.

      As you can probably tell, I favour 2. because it is easier to implement.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  24/Nov/10