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',
|
||||||
'template_allow_change',
|
'template_allow_change',
|
||||||
'vocations_amount',
|
'vocations_amount',
|
||||||
|
'vocations',
|
||||||
'client',
|
'client',
|
||||||
'session_prefix',
|
'session_prefix',
|
||||||
'friendly_urls',
|
'friendly_urls',
|
||||||
@ -44,11 +45,3 @@ foreach ($deprecatedConfig as $key => $value) {
|
|||||||
//var_dump($settings['core.'.$value]['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;
|
$this->cache[$offset] = $ret;
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
@ -142,6 +142,11 @@ return [
|
|||||||
'type' => 'textarea',
|
'type' => 'textarea',
|
||||||
'desc' => 'Separated by comma ,',
|
'desc' => 'Separated by comma ,',
|
||||||
'default' => 'None, Sorcerer, Druid, Paladin, Knight, Master Sorcerer, Elder Druid,Royal Paladin, Elite Knight',
|
'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' => [
|
'client' => [
|
||||||
'name' => 'Client Version',
|
'name' => 'Client Version',
|
||||||
@ -673,6 +678,11 @@ Sent by MyAAC,<br/>
|
|||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'desc' => 'This looktypes needs to have different margin-top and margin-left because they are wrong positioned',
|
'desc' => 'This looktypes needs to have different margin-top and margin-left because they are wrong positioned',
|
||||||
'default' => '75, 126, 127, 266, 302',
|
'default' => '75, 126, 127, 266, 302',
|
||||||
|
'callbacks' => [
|
||||||
|
'get' => function ($value) {
|
||||||
|
return array_map('trim', explode(',', $value));
|
||||||
|
},
|
||||||
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'type' => 'section',
|
'type' => 'section',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user