So I have this custom site method:
return [
'custom' => function()
{
return [
'fooKey' => 'Foo',
'barKey' => 'Bar',
'bazKey' => 'Baz',
];
},
];
This in the blueprint
fields:
category:
type: radio
options: query
query:
fetch: site.custom
The options seem to be be processed like an array, and not like this:
fields:
category:
type: radio
options:
fooKey: Foo
barKey: Bar
bazKey: Baz
So the actual keys (the values to be saved to the page) get lost and only the text is saved
I also tried returning it differently:
return [
'custom' => function()
{
return [
[
'key' => 'fooKey',
'value' => 'Foo',
],
[
'key' => 'barKey',
'value' => 'Bar',
],
[
'key' => 'bazKey',
'value' => 'Baz',
],
];
},
];
or
return [
'custom' => function()
{
return [
[
'value' => 'fooKey',
'text' => 'Foo',
],
[
'value' => 'barKey',
'text' => 'Bar',
],
[
'value' => 'bazKey',
'text' => 'Baz',
],
];
},
];
But either errors about an invalid format are thrown or be above described array conversion takes place.
I also played around with the mapping options (with different context names [arrayItem, structureItem and so on):
query:
fetch: site.custom
text: "{{ arrayItem.text }}"
value: "{{ arrayItem.value }}"
To no avail.
Thanks for any help in advance.