MDL-69772 admin: Better validation for the allcountrycodes setting

The patch introduces a new admin_setting fiela type that can be used for
specifying comma separated list of countries. The field has inbuilt
validation so that only valid country codes can be inserted.
This commit is contained in:
David Mudrák
2020-10-01 13:38:48 +02:00
parent 2a1fb5b5e7
commit d335530a28
4 changed files with 92 additions and 2 deletions
+2 -2
View File
@@ -49,8 +49,8 @@ if ($hassiteconfig) {
$temp->add(new admin_setting_configtext('googlemapkey3', new lang_string('googlemapkey3', 'core_admin'),
new lang_string('googlemapkey3_help', 'core_admin'), '', PARAM_RAW, 60));
$temp->add(new admin_setting_configtext('allcountrycodes', new lang_string('allcountrycodes', 'core_admin'),
new lang_string('configallcountrycodes', 'core_admin'), '', '/^(?:\w+(?:,\w+)*)?$/'));
$temp->add(new admin_setting_countrycodes('allcountrycodes', new lang_string('allcountrycodes', 'core_admin'),
new lang_string('configallcountrycodes', 'core_admin')));
}
$ADMIN->add('location', $temp);