Susticle Posted October 31, 2017 Share Posted October 31, 2017 Hello everybody, I'm doing websites with Processwire for some time now. Now there is the first time I need to setup a hook. I created a module, that was no problem. I added a hook: Quote $this->pages->addHookbefore('save', $this, 'checkMethod'); In checkMethod I can check for errors and give out an error message with $this->error. With event->replace in case of errors I can prevent saving the wrong data. Everything's fine. But still I get the message that the page has been saved. So I think I did something wrong. What's the correct way to add a hook that checks the data, gives out an error message and prevents the page from being saved? Thanks, Lars Link to comment Share on other sites More sharing options...
abdus Posted October 31, 2017 Share Posted October 31, 2017 Hook into Pages::saveReady instead and throw error inside checkMethod() 1 Link to comment Share on other sites More sharing options...
Susticle Posted October 31, 2017 Author Share Posted October 31, 2017 On 10/31/2017 at 3:40 PM, abdus said: Hook into Pages::saveReady instead and throw error inside checkMethod() Thank you very much! Link to comment Share on other sites More sharing options...
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