Sorry for the confusing title. I’m not sure how to briefly summarize my problem.
I’m trying to migrate a Kirby 2 installation to Kirby 3 and got stuck on a blueprint with a query.
It searches the children of the manufacturers page and saves the uid of the selected entry. In Kirby 2 it works fine.
fields:
manufacturer:
label: Manufacturer
type: select
options: query
query:
page: manufacturers
fetch: children
value: '{{uid}}'
text: '{{title}}'
I tried to adapt the code to the new syntax in Kirby 3 and got it to work:
fields:
manufacturer:
label: Manufacturer
type: select
options: query
query:
fetch: site.find("manufacturers").children
value: "{{page.uid}}"
I can select the entry based on the title and the UID gets saved like in Kirby 2. But after the changes are saved, the selection is no longer visible in the panel. I guess, Kirby 3 can’t get the right selection based on the UID.
If delete the last line Kirby saves the page id, and the issue is gone.
Is there an easy way to get this working with the UID like in Kirby 2 or is using the page id the only option?
I rather have “Manufacturer: company1” then “Manufacturer: manufacturers/company1” in my data to avoid redundancy.
My ultimate goal is to get data from the manufacturers page. I used to do it like this:
<?= $pages->find('manufacturers/' . $page->manufacturer())->title()->html() ?>
This is based on the old Kirby 2 cookbook entry about authors. Maybe there is a new way to approach the problem.
Kirby Version 3.0.2