Hi, I am trying to write a basic plugin for myself which allows me to preview certain file types in the backend. So far I cannot see anything in the docs on how to access files on the page (or rather in my VUE template of the plugin) where I am using the field. Can someone give me some guidance on that?
What sort of component are you creating?
at the moment I set up a
field plugin, is that what you mean?
Basically what I want to do, is to load a specific file type from the page where the field is used in the blueprint. That field will only load this file and show it inside a canvas with an external library. I would have created my own template for that.
So it’s not a files field that would automatically give you access to the file.
In that case, you would need a route that fetches the file, and provided you have the filename, you can actually use the existing API endpoint, in this case
OK, this makes sense. What would be the best way to get the page ID inside vue? Through a prop from the blueprint ?
The page should be available through
this.$attrs.endpoints, but if you inspect
this in the console, you will find what you need.
If not, you can pass a property through the index.php of your field plugin.