Open bezin opened 7 months ago
We may be able to solve this issue in an easy way, but it will involve a big breaking change. I don't see an easy solution other than using another top level key as you have done as app
, site
.
Maybe someone else from the team remembers why plugin options are added as ['namespace.pluginname']['optionname']
instead as ['namespace']['pluginname']['optionname']
?
Hi all,
I am not sure whether this is a bug or misusage or a known limitation. Please act as you see fit :-)
Description
Using a plugin vendor as top-level vendor key breaks option lookup from plugins.
I grouped some arbitrary config options for a project with our vendor
presprog
. I use this for some theme-related settings like switch ing some things in snippets on or off, basically.We also have some custom plugins that are named
presprog/pluginname
which also have some options:Expected behavior
I have the options only defined in my plugin index file. I have not set or overwritten any value from my site config. When I use the following in my plugin code, I expect
$option = false
However, the following happens: Kirby splits the dot-notated key and checks, if the first key (
presprog
) exists. It does, because I have my theme config grouped under this key. Hence, it does not trypresprog.pluginname
next, but checks for['presprog']['pluginname']['nested_option']['some_plugin_setting']
in the config file, instead of['presprog.pluginname']['nested_option']['some_plugin_setting']
.As this key does not exist,
null
is returned instead offalse
, hence the plugin default options do not work.Now the obivious quick-fix is to use a nother top-level key like
app
orsite
. But I just wanted to leave this here to reason about how to deal with this in the long run.Your setup
Kirby Version
4.1.0