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

Make admin settings work better with the cnfig_plugins table

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.0
    • 2.0
    • Administration
    • None
    • MOODLE_20_STABLE
    • MOODLE_20_STABLE

      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.

            timhunt Tim Hunt
            timhunt Tim Hunt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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