I just realized that despite their strong similarities, I’m not able to specify a template for a type: files field while being able to do so for a type: files section. This leaves me wondering how I can use a files field for images for which I can provide/edit alt text/a caption after uploaded (something that’s easily possible with a files section).
I tried the following but it seems like fields don’t behave like sections with regards to the template field which seems to be ignored:
fields:
photos:
type: files
template: blocks/image # <- doesn't work
Using sections instead of fields allows you to use template:
sections:
photos:
type: files
template: blocks/image # <- works
I can’t figure out how to use a field while also allowing to specify additional data for the files (alt text, caption).
I want to use a files field because of the following files section limitation:
Contrary to a files field, the file does not become part of the content, i.e. it is not referenced in the content file.
Source: Files section | Kirby CMS
The files I want to attach to my posts should be part of the content.
Furthermore, if I switch to file sections, I seem to need to re-upload all images in my site because the panel no longer displays the uploaded files from the files field in the panel UI. The files are technically still present (both on disk and as far as programmatic access is concerned). They also still render as part of the live content.