Run plugin first from config.php

When I run this in config.php:

kirby()->plugin('test');

Then that plugin loads and then the other plugins don’t load at all. Is it expected behavior?

My intention was to load this plugin first and let the rest load after that. Should I use GLOB to get all the plugin paths or is there a better way to load the rest of the plugins?

I can’t load this plugin from another plugin in this case because there is no other plugin.

It’s not expected behavior but what you are trying to do is just not intended. Why do you need to load the plugin in config.php? Maybe we can find a more robust solution.

I have a plugin that uses hooks which I need to load first before hooks from all other plugins.

I could rename it to “aaa” but that’s not so nice.

I’m doing it like Jeff Bezos: Why do the hooks need to be loaded first?

I’m doing it like Jeff Bezos: Why do the hooks need to be loaded first?

By always answer with a question? :wink:

Taaadaa! :slight_smile:

I hope to find a better solution for the plugin to be loaded first.

Must be loaded first

Kirby Hooks Debugger needs to load before any other plugin that uses hooks in order to work. There are at least two ways to do that:

Alternative 1 - Rename the plugin

Rename the folder kirby-hooks-debugger to aaa and the file kirby-hooks-debugger.php to aaa.php.

Alternative 2 - Load the Kirby Hooks Debugger plugin from your plugin

If you are building a plugin you can add this line to force load the Kirby Hooks Debugger plugin.

Hm, I’d register the shutdown function in the plugin file instead of in the hook. Disadvantage: You don’t get the name of the hook. Advantage: It just works™.

Only thing you need to be careful about is to register the shutdown function only if the Panel is loaded (function_exists('panel')).


No, it’s called the “Five Whys”. :slight_smile:

Disadvantage: You don’t get the name of the hook. Advantage: It just works™.

Yes, maybe I’ll go with simplicity. Hopefully it’s not that hard to figure out which hook is fired.

No, it’s called the “Five Whys”.

Alright, I’ve read about the five whys now. Interesting.

I’ve also been thinking that with too many questions, it will always end up in biology, physics, psychology or space.

  1. Why do the hooks need to be loaded first?
    Because the plugin will work as expected.
  2. Why do you want the plugin to work?
    Because it helps me develop other things.
  3. Why do you develop other things?
    Because I enjoy it.
  4. Why do you enjoy it?
    My brain tells me to.
  5. Why does you brain tell you to.
    It’s a part of my survival instinct to develop stuff.
  6. Why do you need to survive?
    To make the earth a better place.
  7. Why do you need the earth to be a good place?

A little off topic again, I know…

2 Likes

Hahah, your conversations sometimes remind me of the two old guys from the Muppets. Pure gold!

Haha! :slight_smile:

The only thing I rembember from that show is a frog named Kirby (or was it Kermit)? :smiley: :wink:

Oh, I also remember the cookie monster. I’m not too fond of cookies, except for persisted ones. :cookie:

I thought you’d remember the Swedish Chef :joy:

2 Likes