You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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: )
The text was updated successfully, but these errors were encountered:
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 inGuestEntriesController
into the newGuestEntriesService
which I created and then replaced the call to that method from the controller which was$this->onBeforeSave
tocraft()->guestEntries->onBeforeSave
Let me know if this makes sense or maybe I need to drink some more coffee: )
The text was updated successfully, but these errors were encountered: