The project uses the currently latest Kirby version 3.7.5
But the code above is part of an own plugin. Probably the template name gets lost somewhere.
Any ideas of how to debug?
The file blueprint doesn’t have to exist in order to be assigned to a file’s meta data. But of course you need it if you want to fill the fields defined in that file blueprint.
Best way to debug would be via xDebug. Put a breakpoint in /kirby/api/config/routes/files.php, line #43, then check the request data as a first step.
Fieldname may not be “template”. If I change it to “test” it is working.
In my use case, I need the possibilty to change the files template at a later time via blueprint. This is why I added the select field above. Probably I can solve it with a hook.
I could solve it via hook. Attached the updated files in case someone has the same problem.
the new file blueprint:
sections:
content:
type: fields
fields:
newtemplate: // <- this name may not be "template"
label: Template
type: select
options:
- hero
- gallery
- etc...
I have a couple of different custom blocks (e.G. hero, feature, testimonial, etc). The used image(s) get the block name as template. So i know which image is used by which block per page. By changing the image template, its possible to use it with a different block than it was initial uploaded.
query: site.images
is for the filepicker, not for the upload, if I understand it right