Events: The Object Oriented Hook System

We now know that we have an Event system in place in Drupal 8 which has been imported from Symfony, the Symfony Event Dispatcher Component. The Event system will likely replace the traditional hook system altogether in coming drupal versions. This talk will try to throw some light on how to  create, trigger, subscribe and listen to events in drupal 8.

This session will mainly elustrate:

  • What are Events. Why do we need to trigger events?
  • What all do we need Events for and where we are still stuck with hooks. 
  • Events in Drupal 8
  • Symfony Event Dispatcher component
  • When to fire an event.
  • When to expose your hook in Drupal 8? Never.
  • How to create and dispatch an Event from your module.
  • How to listen or subscribe to an Event from your custom Event or an event from core.
  • How are event listeners and event subscribers different.
  • Different types of Event dispatchers.
  • Examples where events have been exhaustively used.
  • A simple demo implementation of events.

Attendees should be familiar with:

  • Basic Drupal 8 module development.
  • Basic OOP principles and practices.
  • Symfony components used in D8.

 After attending this session attendees will be able to:

  • Create their custom events in Drupal 8
  • Subscribe to the events from core and other modules and to their custom events too.
  • Will have a knowledge of where to explore the events and where we have to still use hooks.