Jump to content

What hook to use when a page and all of its repeaters (and nested repeaters) have been saved?


Recommended Posts

I have a page that has a two repeater fields.  Those two repeater fields have nested repeaters, etc.

I want to run a hook after the page has been saved, BUT only after all the repeaters and nested repeaters have been saved as well.

If I use addHookAfter on Pages::saved(template=mytemplate), the hook fires after the page is saved, but before all the repeaters and nester repeaters are saved.

What's the correct way to do this?

Link to comment
Share on other sites

Maybe use a nested hook?

$wire->addHookAfter(Pages::saved(template=repeater_parent_repeater), function($e){
    $e->addHookAfter(Pages::saved(template=repeater_nested_repeater), function($e){
		// ProcessWire magic!
    });
});

Just be sure it's not executing in odd places. 

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...