mirror of
https://github.com/slawkens/myaac.git
synced 2025-05-01 19:59:21 +02:00
Add settings.callbacks.get
This commit is contained in:
parent
e83880653a
commit
afa1adb90b
@ -4,6 +4,7 @@ $deprecatedConfig = [
|
||||
'template',
|
||||
'template_allow_change',
|
||||
'vocations_amount',
|
||||
'vocations',
|
||||
'client',
|
||||
'session_prefix',
|
||||
'friendly_urls',
|
||||
@ -44,11 +45,3 @@ foreach ($deprecatedConfig as $key => $value) {
|
||||
//var_dump($settings['core.'.$value]['value']);
|
||||
}
|
||||
|
||||
$vocationsParsed = array_map(
|
||||
function(string $value): string {
|
||||
return trim($value);
|
||||
},
|
||||
explode(',', setting('core.vocations'))
|
||||
);
|
||||
|
||||
config(['vocations', $vocationsParsed]);
|
||||
|
@ -434,6 +434,10 @@ class Settings implements ArrayAccess
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($ret['callbacks']['get'])) {
|
||||
$ret['value'] = $ret['callbacks']['get']($ret['value']);
|
||||
}
|
||||
|
||||
$this->cache[$offset] = $ret;
|
||||
return $ret;
|
||||
}
|
||||
|
@ -142,6 +142,11 @@ return [
|
||||
'type' => 'textarea',
|
||||
'desc' => 'Separated by comma ,',
|
||||
'default' => 'None, Sorcerer, Druid, Paladin, Knight, Master Sorcerer, Elder Druid,Royal Paladin, Elite Knight',
|
||||
'callbacks' => [
|
||||
'get' => function ($value) {
|
||||
return array_map('trim', explode(',', $value));
|
||||
},
|
||||
],
|
||||
],
|
||||
'client' => [
|
||||
'name' => 'Client Version',
|
||||
@ -673,6 +678,11 @@ Sent by MyAAC,<br/>
|
||||
'type' => 'text',
|
||||
'desc' => 'This looktypes needs to have different margin-top and margin-left because they are wrong positioned',
|
||||
'default' => '75, 126, 127, 266, 302',
|
||||
'callbacks' => [
|
||||
'get' => function ($value) {
|
||||
return array_map('trim', explode(',', $value));
|
||||
},
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'section',
|
||||
|
Loading…
x
Reference in New Issue
Block a user