Perry
1
How can I send a message to the panel after a successful hook?
I tried that:
'page.update:after' => function ($newPage, $oldPage)
{
try{
if($newPage->title()== "Poster"):
exec("wkhtmltopdf https:/magermilch.cc/de/poster content/poster/poster.pdf");
endif;
$panel()->notify('the pdf was created');
} catch(Exception $e)
{
$e->getMessage();
}
}
greetings perry
texnixe
2
You can only throw an exception from a hook, there’s no such thing as panel()->notify()
in K3.
Perry
3
is an exeption an error message ?
texnixe
4
The exception pops up a message that can contain anything:
throw new Exception('hey, congrats, your poster was successfully saved as PDF');
The user can then dismiss this message.
1 Like
Perry
5
like this ?
page.update:after' => function ($newPage, $oldPage)
{
try{
if($newPage->title()== "Poster"):
exec("wkhtmltopdf https://magermilch.cc/de/poster content/poster/poster.pdf");
endif;
throw new Exception('hey, congrats, your poster was successfully saved as PDF');
} catch(Exception $e)
{
$e->getMessage();
}
}