API page: https://api.drupal.org/api/drupal/core%21core.api.php/group/events/
Problem
The code example in the documentation for subscribing to an event uses the wrong method signature. It needs to be a static method.
Proposed resolution
Change this:
public function getSubscribedEvents()
To this:
public static function getSubscribedEvents()
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 2828642-3-event_subscriber_documentation.patch | 638 bytes | eojthebrave |
| #2 | 2828642-2-event_subscriber_documentation.patch | 631 bytes | eojthebrave |
Comments
Comment #2
eojthebraveComment #3
eojthebraveThis is actually probably a better solution as it makes the method both public, and static. Which matches the interface exactly.
Comment #4
amber himes matz#3 Looks good. Thanks @eojthebrave.
Comment #5
amber himes matzUpdating status to RTBC.
Comment #6
alexpottCommitted and pushed d558fbe to 8.3.x and 210f8ff to 8.2.x. Thanks!