We're continuing to fill out our Drupal 8 Module Development Guide. This week we added four new tutorials on subscribing to and dispatching events. This is essential knowledge for any Drupal 8 module developer.
The use of events is new in Drupal 8, and is used to replace various hooks from Drupal 7. The Event API builds on the Symfony event dispatcher component, and introduces an object-oriented way for modules to communicate with one another. As a module developer you'll subscribe to events to react to actions taken in other parts of the system (e.g.: a configuration object was just saved), as well as dispatch new events to allow others to interact with your module's logic without modifying your code.
While hooks still exist in Drupal 8, we anticipate that in the future we'll see events used to replace them more and more frequently, so learning what they are and how they work will be useful immediately, and will help prepare you for the future.
Ready to get started subscribing to and dispatching events?
Next up, we'll tackle hooks, the inter-module communication workhorse of Drupal. In addition we also have tutorials on Drupal 8's Entity API in the hopper. Expect to see those soon.
Are there any Drupal 8 module development topics you're itching to learn more about? Let us know.
Add new comment