eydun Posted October 28, 2019 Share Posted October 28, 2019 I have this code in ready.php: <?php namespace ProcessWire; $this->addHookAfter('ProcessPageEdit::processInput', $this, 'apiFunction'); function apiFunction($event) { die("testing"); } When I run it, I get this error: Any advice is appreciated? Link to comment Share on other sites More sharing options...
MoritzLost Posted October 28, 2019 Share Posted October 28, 2019 Your function isn't a method on a class, but you pass $this as the second argument, so the system looks for a method "apiFunction" on $this, which doesn't exist. If you pass null instead as the second argument, it will look for a function instead, it should work then: <?php namespace ProcessWire; wire()->addHookAfter('ProcessPageEdit::processInput', null, 'apiFunction'); function apiFunction($event) { die("testing"); } 4 1 Link to comment Share on other sites More sharing options...
eydun Posted October 28, 2019 Author Share Posted October 28, 2019 Thanks! 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