Plugin load order?

Let’s say I have these plugins…

custom-plugin
test-plugin

Now the “test-plugin” is like a core plugin and the “custom-plugin” is more of a configuration plugin with custom functions.

Plugin name desides load order

“custom-plugin” is loaded before “test-plugin”. In this case it will be a problem because “custom-plugin” uses functions from “test-plugin”.

Is there a way to manage the plugin load order? I can rename the plugin but I don’t feel it should be desided by its name?

You can load your plugin dependencies from within the plugin that needs it:

$returnValue = kirby()->plugin('test-plugin');

The test-plugin plugin won’t be loaded again later, so using that function as often as you need doesn’t cause any problems. The return value is stored for later use.

2 Likes

Very simple, clever and it worked out of the box.

I’m also very impressed about your knowlage about code and Kirby. You often have awesome answers to hardcore questions. Thanks!

Thanks a lot! :blush:
Since I’m regularly helping developing Kirby in my spare time for I guess three years now, I have been digging through the Kirby code a lot. :wink:

Lukas is the Best-le :stuck_out_tongue_winking_eye:

[… sorry for that spam post]

Glad you don’t know how often I have heard this joke in both English and German. :smiley: