I’m currently building a custom Kirby field and most of its interaction is written in Javascript. There’s a dozen of options available when you initialize the script. I’d like to be able to set field defaults via the c::set methods in my config.php file and have overrides in my field options in my blueprint. I can’t figure out how to do it though.
The settings are saved in the class’ properties, how to I return these values to my Javascript initialization function ?
I can’t seem to be able to make the bridge between PHP and JS.
I can put the init method in my main plugin JS file, but if I wanted the options to be customizable by the user via Kirby’s c::get() methods, how would I do that?
Let’s say I want to change entity_encoding, I don’t like the default value of raw. It can take 2 other values numeric and named.
I’d love to be able to do this via my config.php file or my blueprint.
c::set('plugin.tinymce.entityencoding', 'named');
I guess I could have a PHP file output JS with appropriate headers. Not sure…