Jump to content

Hooks, ::added or/and ::saveReady


Recommended Posts


a question of a hook newbie... Probably a simple one, but nonetheless i don't get it after reading the docs and playing around.

While in admin i do something with some page fields before saving a page (here: generating vcards). If the page already exists (e.g. edit the page), its straight forward:

$wire->addHookBefore('Pages::saveReady', function($event){
	$page = $event->arguments(0);
	// do something with some $page fields...

But i forgot to handle the case when a page is added. This naturally this leads to a

ProcessPageAdd: New page '/path/to/page' must be saved before files can be accessed from it

For my understanding, i somehow must differ between Pages::added and Pages::save (or Pages::saveReady) and/or combine the two respectively.  Anyway, i assume this may not quite right, so i am running out of ideas. Maybe someone could give me some advice how this should be done.

Thx in advance!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...