Hello,
I think I’m running into a similar issue than this one: [Cms] Plugin options arrays aren't overriding the default ones · Issue #1088 · getkirby/kirby · GitHub.
The difference is, instead of an array of values:
'myarray' => [ 'Option_A', 'Option_B', 'Option_C', 'Option_D', 'Option_E']
…I’m trying to setup an array of key => value
pairs.
Kirby::plugin('abc/xyz', [
'options' => [
'myarray' => [
'Option_A' => 'Option A',
'Option_B' => 'Option B',
'Option_C' => 'Option C',
'Option_D' => 'Option D',
'Option_E' => 'Option E',
]
]
]);
I’m using it to define the options of a select field:
fields:
platform:
type: select
options:
type: query
query: kirby.option('abc.xyz.myarray')
Unfortunately, when I try to override the value of myarray within the project’s config.php
like this:
'abc.xyz.myarray' => [
'Option_C' => 'Option C renamed',
'Option_D' => 'Option D',
'Option_Z' => 'Option Z',
]
…then option('abc.xyz.myarray')
returns the combination of the original and the custom config, instead of overwriting it:
[
'Option_A' => 'Option A', // should be removed
'Option_B' => 'Option B', // should be removed
'Option_C' => 'Option C renamed', // ok, value changed
'Option_D' => 'Option D', // ok, kept
'Option_E' => 'Option E', // should be removed
'Option_Z' => 'Option Z', // ok, added
]
Am I missing something?