Juergen Posted April 5, 2018 Share Posted April 5, 2018 Hello, I am struggeling with a problem to run a hook after the save button of a specific setup page was pressed. I thought that I can use a default "saveReady" hook inside the ready.php to run a specific logic, but it doesnt work. I use the id of the admin page to run this hook only if the save button on this page was pressed. This is the test hook that i run inside ready.php on an admin page with the id 39407 $pages->addHookAfter('saveReady', function($event) { $page = $event->arguments(0); if($page->id == 39407){ $this->message('Save button pressed on an admin page'); } }); If the hook was triggered the message should appear after saving, but nothing will be displayed. So it seems the hook will not be triggered. Tracy didnt display the hook too. What is the correct way of triggering hooks on admin pages? I hope someone can help me out. Link to comment Share on other sites More sharing options...
dragan Posted April 5, 2018 Share Posted April 5, 2018 Are you sure $page / $page->id are even recognized? 1 Link to comment Share on other sites More sharing options...
Juergen Posted April 5, 2018 Author Share Posted April 5, 2018 The problem is that the hook will not be triggered after pressing the save button. This doesnt work too $pages->addHookAfter('saveReady', function($event) { $this->message('Save button pressed on an admin page'); }); If I press the save button of a page outside of the admin page it works. It affects only pages under the admin page. Link to comment Share on other sites More sharing options...
Juergen Posted April 5, 2018 Author Share Posted April 5, 2018 Sorry, there was a mistake!!!!!! It affects pages which are under the Setup section!! 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