eydun Posted October 28, 2019 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?
MoritzLost Posted October 28, 2019 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
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