Module Development

Dispatch an Event for Drupal 8, 9, and 10

Modules or subsystems can dispatch events in order to allow another developer to subscribe to those events and react to what's happening within the application. As a module developer you'll learn how to:

  • Define and document new events
  • Define new event objects
  • Use the event dispatcher service to alert event subscribers when specific conditions are met in your own code.

By the end of this tutorial, you should be able to explain the use case for dispatching events, and be able to trigger one more events from within your own code.

Drupal Module Development