It would be great to separate the config files of the plugins to make it easier, clearer and better to manage the config of the plugins.
Example structure:
/site/config/config.php
/site/config/plugins/distantnative-retour.php
/site/config/plugins/distantnative-retour.localhost.php
/site/config/plugins/texnixe-filesdisplay-section.php
/site/config/plugins/getkirby-kql.php
You can do that manually already in your config.php
return [
'distantnativ.retour' => require './distantnative-retour.php'
];
Even for different evnironments, e.g. in config.localhost.php
return [
'distantnativ.retour' => require './distantnative-retour.localhost.php'
];
Yes, we already use it that way. It would be great if this was Kirby’s default behavior. This feature is also an extremely easy method for the developer or end users who installed the plugin.
I think the tricky part there is, that Kirby would need to load the plugin’s index.php
first to know the namespace of the plugin (e.g. distantnative.retour
- to know for what config file(s) to look.
But the plugins would probablz expect that their options are already present and can be used when index.php
is loaded.
Now I did a little test. I was able to extend options from seperated config files correctly within the constructor method of App class.
But please don’t force separate files. In many cases, extra config files for plugins are absolutely not necessary.
What I think is that it supports both sytnax.
i am in favor of nicos suggestion and find the automatic file loading confusing.