Hi folks,
I’ve done a few websites with kirby 3 but this is my first question. So thumbs up. Great work!
I was searching the whole docs about a general syntax about advanced queries in a blueprint file. In my case i need to filter files by extension.
Here is my example:
image:
label: Bild
type: files
multiple: false
query: page.files.filterBy('extension', 'in', array('jpg', 'svg'))
required: true
The query is not working because the syntax “array” is not correct. Is it even possible to filter by array in blueprints?
Thanks for your help.
Will be in the upcoming Kirby 3.2 release.
Current solution: create a custom files method or a page model.
almost relevant: have you tried:
query: page.images
?
4 sure. But svgs are not images!
Also: https://www.iana.org/assignments/media-types/media-types.xhtml#image
But if you want only jpg and svg in particular, then using page.images doesn’t really do the job.
I’d create a custom page method/model customImages (or whatever) that returns a set of filtered images.
Kirby 3.2 is supposed to be published next week…
The Kirby Docs say:
What is an image file?
…
svg
…
Sorry rasteiner, svgs are images and show up if I use
query: page.images
But I remember used that in previous projects. Must be a bug in the panel.