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
3 years 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'
];
3 years 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.

3 years 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.

3 years 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.

3 years ago

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

3 years ago
2

What I think is that it supports both sytnax.

3 years ago

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

3 years ago