Let’s say I have these plugins…
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');
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.
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!
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.
Lukas is the Best-le
[… sorry for that spam post]
Glad you don’t know how often I have heard this joke in both English and German.
Is there also a workaround to init the own plugin before all the others?
its alphabetically so maybe just use
_myplugin as a folder name or