Sorry, we don't support your browser.  Install a modern browser

Seperated config files for plugins#350

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
a year ago

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'
];
a year ago
2

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.

a year ago

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.

a year ago
1

Now I did a little test. I was able to extend options from seperated config files correctly within the constructor method of App class.

a year ago

But please don’t force separate files. In many cases, extra config files for plugins are absolutely not necessary.

a year ago
2

What I think is that it supports both sytnax.

a year ago

i am in favor of nicos suggestion and find the automatic file loading confusing.

10 months ago