I am developing a Kirby Plugin. Right now, all settings get saved within a blueprint. But I want to move those to a panel area. I was able to integrate my own panel area settings to the menu at the top and read the settings from a .json file.
However, I don’t understand how I can save these settings back to the json. How does the submit Button look like in the Settings.vue and how can I get the form data back into a route and save it?
Basically, im using <k-form>, which is auto generating a submit input with the class “k-form-submitter”, but it is disabled and when I add my own submit button, I can’t seem to send data…
I know this isn’t exactly what you’ve asked for, but maybe this happens to work for you as it does something similar:
The advantage of using a drawer is that you don’t need client components (you reuse k-form-drawer), you just point the sidebar menu entry to the drawer form. The submit functionality essentially comes for free then.
In the plugin I override the “field endpoints” to my own API route, as some fields seem to depend on having a “page” (or probably any kind of model) to be bound to.
So I create a special virtual page where I override the writeContent and readContent methods to write to and read from the json file.
Okay, Basically my solution is to not use <k-form> at all, just use standart <form> and <input> fields and styling them to decorate them like these from kirby, so the look stays consistant.