I’m struggling with some file path stuff using Kirby Builder and Vue.js Starterkit…
For the vue.js API stuff to work, I have to convert from php to json:
<?php $data = [ 'url' => $page->url(), 'title' => $page->title()->value(), 'heroImage' => $page->heroImage()->toFile()->url(), 'overview' => $page->overview()->value(), 'builderBlocks' => $page->projectBlocks()->yaml() ]; echo json_encode($data);
And here is my .txt file generated from the blueprints:
Heroimage: - hero-image-fpo.jpg ---- Projectblocks: - video: - example-video.mp4 caption: "" _key: videoPlayerBlock _uid: videoPlayerBlock_1596324496754_332
Now, the Heroimage above works because I can add the helpers prior to the json encoding:
'heroImage' => $page->heroImage()->toFile()->url()
This returns the full image path, and I can see this in my Vue.js stuff perfectly:
But the Projectblocks come through as one magic array from the
yaml() function, so can’t use these helpers like
file->toFile()->url() since this is all being converted to an array, so it just returns the path like this:
How can I get this to output similar to the hero image example above?
(I know the bbc2e1e530-1595882660 is a unique folder generated per each file upload, so these would be different, this is all just for example purposes…)
Thank you all for your help!!