MDL-68729 Admin: Allow validation of admin_setting_configselect

The admin_setting_configselect admin setting did not support validation.
It was possible to validate only by using a subclass.

This change allows validation by a callback function. It also makes it
slightly easier to handle validation in a subclass if you want to do
that.

The main advantage is for cases where a setting is not generic but
is only ever going to be required in one place, and it creates
unnecessary clutter to make a new subclass.
This commit is contained in:
sam marshall 2020-08-06 11:24:45 +01:00
parent f87597aae3
commit b58009596f
2 changed files with 40 additions and 0 deletions

View file

@ -34,6 +34,8 @@ information provided here is intended especially for developers.
* The class coursecat_sortable_records has been removed.
* Admin setting admin_setting_configselect now supports lazy-loading the options list by supplying
a callback function instead of an array of options.
* Admin setting admin_setting_configselect now supports validating the selection by supplying a
callback function.
=== 3.9 ===
* Following function has been deprecated, please use \core\task\manager::run_from_cli().