Juergen Posted May 12, 2018 Posted May 12, 2018 Hello @ all, only a simple question: Is it possible (and if how) to distinguish if a page was saved via fe a save ready hook or manually by pressing the save button? I have the problem that a special hook function should only run if the save button was pressed by a human. In my case the schedule pages module triggers a hook to set a child page status to unpublished and saves the child page and this save process leads to start another hook which changes some values in the parent page. I only want to run this hook for the parent page if the child page was saved by pressing the save button and not by saving via a hook. if(Save button was pressed) { // run the hook } else { // do not run the hook } Maybe someone has struggled with the same problem and can give me a hint how to deal with this? Best regards
kixe Posted May 12, 2018 Posted May 12, 2018 Does this help? $this->addHookBefore('ProcessPageEdit::processInput', function($e) { if (wire('input')->post('submit_save')) { $e->message("This page has been saved by pressing the 'Save' button."); } }); 4
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now