Timeline for How to define event listener in the service?
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 23, 2018 at 11:24 | vote | accept | voleger | ||
Sep 19, 2018 at 18:44 | history | edited | avpaderno♦ |
edited tags
|
|
S Sep 19, 2018 at 16:53 | history | suggested | berramou | CC BY-SA 4.0 |
Format links
|
Sep 19, 2018 at 16:45 | comment | added | 4uk4 | You could point an event listener to any php callable, but Drupal doesn't use event listeners, only subscribers. An event subscriber class is always a service, implementing getSubscribedEvents() to define which class method to trigger on the desired event. | |
Sep 19, 2018 at 15:10 | answer | added | Cesar Moore | timeline score: 2 | |
Sep 19, 2018 at 14:43 | review | Suggested edits | |||
S Sep 19, 2018 at 16:53 | |||||
Sep 19, 2018 at 14:29 | comment | added | Clive♦ | You can't define an event listener in a service (that wouldn't make sense, what's guaranteeing that the service has even been instantiated when the event is raised?). But you can inject a service into the event listener, and call a method on it that way, which achieves the same thing | |
Sep 19, 2018 at 14:13 | history | asked | voleger | CC BY-SA 4.0 |