I thought it would be clever to add a files section to a file blueprint in order to be able to provide alternative files (in this case for a video). That way I could upload a main file (e.g. a WebM video) and provide one or multiple fallbacks (e. g. an MP4 video)—on a per-file basis.
# blueprints/files/video.yml sections: alternativeFiles: type: files
When I set this up and don’t provide the
parent option, I see an error when trying to upload a file:
No route found for path: "pages/projects+test-123/files/video.mp4/files" and request method: "POST"
When I look at the route it looks like Kirby is treating the file like a page and tries to access its
So I tried to set the section parent to the main file’s parent by adding
parent: file.parent to the blueprint. Now, instead of the files section, I see an error in the panel (I replaced the private path with xxx):
Kirby\Cms\File::is(): Argument #1 ($file) must be of type Kirby\Cms\File, Kirby\Cms\Page given, called in xxx/kirby/config/sections/files.php on line 115.
Therefore I tried it with
parent: page.parent and get this error instead:
The parent for the query "page.parent" cannot be found in the section "alternativeFiles"
Should this be possible? Am I doing something wrong? I think it would be a neat solution for the fallback / alternative file type problem.