MDL-72984 admin: make support email setting mandatory

This commit is contained in:
Simey Lameze
2021-11-12 09:44:02 +08:00
parent 58a729f088
commit eadf157068
10 changed files with 50 additions and 9 deletions

View File

@@ -4838,6 +4838,29 @@ class admin_setting_sitesettext extends admin_setting_configtext {
}
/**
* This type of field should be used for mandatory config settings.
*
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class admin_setting_requiredtext extends admin_setting_configtext {
/**
* Validate data before storage.
*
* @param string $data The string to be validated.
* @return bool|string true for success or error string if invalid.
*/
public function validate($data) {
$cleaned = clean_param($data, PARAM_TEXT);
if ($cleaned === '') {
return get_string('required');
}
return parent::validate($data);
}
}
/**
* Special text editor for site description.
*