mirror of
https://github.com/moodle/moodle.git
synced 2025-07-25 00:02:18 +02:00
MDL-72984 admin: make support email setting mandatory
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
Reference in New Issue
Block a user