I haven’t used flash messages inside hooks so I had to try it. It can work, but not always.
kirby()->hook('panel.page.create', function($page) {
panel()->notify('Your page has been created!');
panel()->redirect('/');
});
If you try to notify without redirecting, you’ll only see Kirby smile notification: :)
With the redirection, the notification works. Just be aware that panel()->redirect()
is relative to /panel
.
There’s also panel()->alert()
for red error messages.