Hooks without Panel?

Hey there,

I’m doing a website that won’t be used with the Kirby Panel, however I still need to use a couple of hooks.

For example, I have the AutoID plugin for Kirby that I want to use to create IDs for certain pages. It uses panel.page.create to hook into Kirby. I’m not using the Panel, however I’m using the create() method via a POST request in a controller to create new pages. It don’t seem like the hook fires.

$punch = $page->children()->create(
    str::slug('test-' . $data['time-start']),

Am I missing something, is there any work around?


As you said, hooks are only fired, if you use the panel. Otherwise e.g. $page->update() would always trigger itself and lead to an infinite loop, I think?!


Maybe a workaround could be, if you call the onPageCreate() method of AutoID directly after creating the page programmatically?

You can manually trigger an event like this on success:

kirby()->trigger('panel.page.create', $punch);
1 Like