Dear my beloved kirby support,
I have a structure field with content, which should be shown in a selcet field.
Like in the manuel:
Print_version:
type: select
when:
print: true
options:
type: api
url: "{{site.url}}/publication_collection.json"
Then I make a route in config:
'routes' => [
[
'pattern' => 'publication_collection.json',
'action' => function () {
$pubsArray = [];
foreach (page('offentlichkeitsarbeit/veroffentlichungen')->publications()->toStructure() as $pub) {
$pubTitle = $pub->title();
$pubsArray[$pubTitle->toString()] = $pubTitle;
}
return $pubsArray;
},
]
],
When I check the JSON file, it shows an array with key/value pairs as expacted.
I used the same/very similar setup in a site (version 3.9.) and it worked perfectly but now:
The select field is showing just the last item in the list of the JSON. How and why?
–––––
I updated to 4.1.2.
The select field is wrapped in a structure in a block (not sure if that might be a problem here)
Has anything changed in kirby 4 in this matter?
Kind regards and thanks for looking into it.