Settings API - which prefix to use?

Settings API - which prefix to use?

by Henning Bostelmann -
Number of replies: 1
Immàgine de Core developers Immàgine de Plugin developers

Hello

I maintain a plugin that - nasty, nasty - still stores its configuration parameters into the global $CFG object, rather than into the config_plugins table. It's been doing so since pre-1.9 times, and I thought it might be about time to upgrade to the new API now. (But then, the core mod_chat still uses $CFG for its configuration parameters as well.)

To that end, according to the plugin contribution checklist, I should call my settings "plugintype_pluginname/settingname", thus in my case, e.g., "mod_scheduler/maxstudentsperslot". On the other hand, by the exampe in the dev docs, the core quiz module uses e.g. "quiz/timelimit" (not "mod_quiz/timelimit").  Looking at the config_plugins table in my test installation, I see in fact that those settings are stored with "plugin = 'quiz' "; except, however, the setting "version" which is stored with "plugin = 'mod_quiz' " instead.

I understand that the conventions are a bit inconsistent here for historical reasons; but: which convention should I follow? And do you think it's worth migrating these parts of my plugin code at all?

Average of ratings: -
In reply to Henning Bostelmann

Re: Settings API - which prefix to use?

by Tim Hunt -
Immàgine de Core developers Immàgine de Documentation writers Immàgine de Particularly helpful Moodlers Immàgine de Peer reviewers Immàgine de Plugin developers

You should use mod_scheduler/maxstudentsperslot.

The quiz started using config_plugins before the convention was properly established.

I guess i could fix it now, but it would take time, and risk breaking things, so I have not yet.

Average of ratings:Useful (1)