Hey everyone.
I want to access and use my plugin options from config file in a panel plugin.
Here is the code:
panel.plugin("vbadvanced/kirby-persian", {
created(app) {
// Here I want to accces my "vbadvanced.kirby-persian.site.calendar" option.
},
components: {},
fields: {},
});
In the field plugins its as easy as reading and passing options as props for field. but in my case I want to read options and conditionally set some html attributes on the DOM.
Thanks in advance
I think you have to fetch the config options via a custom api endpoint. They don’t seem to be globally accessible.
Maybe you could use the system-loadplugins-after hook somehow for this?
Once this fires, Kirby is in a loaded stated which has the options from config.php
available via the option()
helpers.
Thanks @texnixe , Actually I’ve considered this as the last possible solution. Maybe it’s the only solution to this.
Currently I’m working on a new panel plugin to add support for Persian (Farsi) features to the panel and frontend.
Thanks you for your reply
I’m looking to access options in my js code. The system-loadplugins-after hook is for backend php code.
I don’t know if it’s possible to add any piece of metadata to loaded plugins and use it in frontend later?