I’ve been using page model to create children that are virtual pages pulled from a CSV. It works great. But I’d like to at the same time create virtual files, so I can see the images in the panel.
This should help: Virtual files | Kirby CMS You can define them in the same child page model. It should actually also be possible to add the files via the files key in your children method.
So I was able get the virtual images to work on that sample. But I’m trying to update another site and running into trouble. In my CSV, each entry has multiple image files.
I can return all the images in the entire CSV. Or I can return just the first image.
Sorry I wasn’t clear. I am unable to get the multiple images by $entry. I either get the first image of the $entry or I get images from all the $entry in the csv file.
The JSON response could not be parsed
Array
(
[slug] => 78571
[filename] => Array
(
[0] => 78571-01.jpg
[1] => 78571-02.jpg
[2] => 78571-03.jpg
)
[template] => virtual-file
[content] => Array
(
[alt] => Artwork by Firstname Lastname
)
)
{"status":"error","message":"Argument 1 passed to Kirby\\Cms\\File::setFilename() must be of the type string, array given, called in \/Users\/sarah\/Sites\/3x3new\/kirby\/src\/Toolkit\/Properties.php on line 138","code":500,"exception":"TypeError","key":null,"file":"File.php","line":511,"details":[],"route":"pages\/([a-zA-Z0-9\\.\\-_%= \\+\\@\\(\\)]+)\/sections\/([a-zA-Z0-9\\.\\-_%= \\+\\@\\(\\)]+)"}