Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AdminController::taskSaveas() does not trigger "onAdminSave"-Event #1544

Closed
nmaier95 opened this issue Nov 16, 2018 · 2 comments
Closed

AdminController::taskSaveas() does not trigger "onAdminSave"-Event #1544

nmaier95 opened this issue Nov 16, 2018 · 2 comments

Comments

@nmaier95
Copy link

Hi there,

Is it on purpose the controller-action mentioned in the title doesn´t trigger the onAdminSave-Event as well as the normal save action?

Thanks in advance!

@rhukster
Copy link
Member

rhukster commented Dec 4, 2018

Not that I can think of. If you add this before the $aPage->save() in the taskSaveas() method:

$this->grav->fireEvent('onAdminSave', new Event(['page' => $obj]));

Do things work as expected? I've not had chance to test.

@nmaier95
Copy link
Author

nmaier95 commented Dec 5, 2018

I actually added the line by myself already to test it, and it did the job.

Furthermore I added an if-condition to check in both saving actions of the admincontroller if any hook called stopPropagation() on the event-object to not continue saving the page, for example if the user does not have the rights to save the currently selected locale. Don't know if this is wanted by the core-team of this plugin, but I'd do an pullrequest if so? Just let me know.

Else, the single line posted above is all I would suggest to add.

Greetings!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants