Open daledavies opened 1 month ago
For this to be accomplished in the "Moodle way", we may consider converting our external Instances management page to a proper Moodle admin setting class? Then the Moodle magic could take over in case of configuration via config.php. Or is it feasable to considdr the case of configuration via config.php manually? I've never developed it for an external admin page.
To move away from using an external admin page would we need to stop saving instances to our own DB table, then we'd need to think of a format (like json) for them to get saved using set_config()
or something?
Not necessarily, we'd have to define our own setting class and can overwrite the read and write methods... https://github.com/moodle/moodle/blob/main/lib/adminlib.php#L1960 I'm on my mobile right now, so looking for examples is a bit cumbersome, but werden be able to pull it of... Also we can decide on our own format for pre-defined settings, even enforce them via config.php.
Or maybe the abstract read_setting() and write_setting() methods... need to take a Look at the big screen. https://github.com/moodle/moodle/blob/main/lib/adminlib.php#L2026
admin_setting_sitesetselect uses a DB table to store its settings. https://github.com/moodle/moodle/blob/main/lib/adminlib.php#L2026
admin_setting_bloglevel and others too...
Just thinking a bit about this again. tool_log_setting_managestores
implements the entire management table as a setting class, but this doesn't have any custom write_setting method.
To allow provisioning of sites with
tool_registrationrules
preconfigured, could we have a way to provide rule instances config as something like json? This could be provided inconfig.php
via$CFG->forced_plugin_settings
and would override UI config, stopping admins from using the rule instance management page.Something like this would allow us to provision sites without needing to manually configure them.