Hey,
I am working on a field plugin that allows me to select a file and to do some other stuff with it. I am struggling to get the <k-files-field />
component running. the vue component for my custom field looks something like this:
<template>
<k-field
label="SEO und Social Media"
>
<!-- do some stuff here -->
<k-files-field
name="filesfield"
v-model="files"
:endpoints="endpoints"
/>
<!-- and some more stuff here -->
</k-field>
</template>
<script>
export default {
data() {
return {
files: []
};
},
props: ["endpoints"],
};
</script>
I can’t get my head around on how exactly the logic around the endpoint object works. This parameter is automatically passed to my field and looks something like this:
{
"field":"pages/blog+licensing-kirby/fields/myfieldname",
"section":"pages/blog+licensing-kirby/sections/main-col-0-fields",
"model":"pages/blog+licensing-kirby"
}
The files object appears to require this as a property. The file field needs the field
path to build the route /api/pages/blog+licensing-kirby/fields/myfieldname
that seems to be used to ask the server for the files. However, this does not work anymore when the files field is nested into my own custom field. I get the error message “The files query does not seem to be correct” when I try to select a file. I guess this is because the route does only contains the path to my custom field (here it is the field with the blueprint name “myfieldname”) and not to the files field.
What is the best approach to get the files field running inside a custom field? Do I have to override the endpoints object with my own api route? I tried this, but the api route handling seems not to let my request through to my route actions.
Thanks in advance,
Tim