Add new possibility: to deny saving setting if condition is not met

This commit is contained in:
slawkens
2023-07-22 14:37:57 +02:00
parent 3236f1aebb
commit 20dd49b1c5
4 changed files with 40 additions and 3 deletions

View File

@@ -1301,6 +1301,16 @@ Sent by MyAAC,<br/>
'desc' => 'What to give to player after donation - what column in accounts table to use.',
'options' => ['premium_points' => 'Premium Points', 'coins' => 'Coins'],
'default' => 'premium_points',
'callbacks' => [
'beforeSave' => function($key, $value, &$errorMessage) {
global $db;
if ($value == 'coins' && !$db->hasColumn('accounts', 'coins')) {
$errorMessage = "Shop: Donate Column: Cannot set column to coins, because it doesn't exist in database.";
return false;
}
return true;
}
]
],
'account_generate_new_reckey' => [
'name' => 'Allow Generate New Key',