Hello,
I try to query a collection as options for a select field. It seems that the query correctly fetches the collection since the select field displays the correct number of items but the texts and values are blank.
The collection :
<?php
return function ($site) {
$blockTemplates = [];
$pages = $site->index();
foreach ($pages as $page) {
if ($page->composition()->isNotEmpty()) {
$blocks = $page->composition()->toBlocks();
foreach ($blocks as $block) {
if ($block->isTemplate()->value() == 'true') {
$blockTemplate = $block;
$blockTemplates[] = $blockTemplate;
}
}
}
}
return $blockTemplates;
};
The field :
template:
type: select
options: query
query:
fetch: kirby.collection('block-templates')
text: "{{ arrayItem.templateName }}"
value: "{{ arrayItem.templateName }}"
The result :
Thank you for your help !