How to define, dispatch, and subscribe an event from your custom Module in Drupal 8?

rakesh.gectcr

How to define, dispatch, and subscribe an event from your custom Module in Drupal 8? (hooks, services, plugins and  Events in Drupal 8)

As we all know, In Drupal 8 we are using Symfony Event component. In Drupal 9 mostly events are going to play a major role. Any way that is the future, here in our session would like to discuss about the following questions?

  1. What is an Event in Drupal 8?

  2. How to create or define your own event in a custom module?

  3. How to dispatch your event from a custom module?

  4. How to subscribe the events(including the custom and already available core events as well) in your custom module?

Well, before we discussing on the above topics, we need to make sure the attendees has the knowledge of following topic,

  1. Service containers in Drupal 8, How to do Dependency injection in Drupal 8?

So will discuss this first then will discuss about the define, dispatch and subscribe an event from  your custom module?

Finally we will be having the demo of our custom module. And will conclude a brief discussion with present and future of hooks in Drupal 8.

Reference:http://valuebound.com/resources/blog/how-to-define-an-event-dispatcher-and-subscriber-drupal-8

Expected attendees:

 Drupal devs , who is having basic knowledge about the Drupal 8 development, or Symfony components.

Attendee's take away:

 How to use Events in Drupal 8 development?

Session Track

Symfony

Experience Level

Intermediate

Drupal Version