Jump to content

How to hook after saving a page inside the setup section


Juergen
 Share

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...