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

onBeforeSave not Triggering #1

Closed
selvinortiz opened this issue Mar 28, 2014 · 0 comments
Closed

onBeforeSave not Triggering #1

selvinortiz opened this issue Mar 28, 2014 · 0 comments

Comments

@selvinortiz
Copy link
Contributor

Hey Brad,
I don't think we can raise an event within the context of a controller, at least not one that a plugin.init() will be able to register for, though I could be wrong.

During testing, I found that onBeforeSave was not triggering (using your example which seems accurate) so I went ahead and added a service and using $this within the context of a service actually worked.

So I basically moved the onBeforeSave method in GuestEntriesController into the new GuestEntriesService which I created and then replaced the call to that method from the controller which was $this->onBeforeSave to craft()->guestEntries->onBeforeSave

Let me know if this makes sense or maybe I need to drink some more coffee: )

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

No branches or pull requests

1 participant