Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
EventDispatcher provides integration with Symfony EventDispatcher component for Drupal 7.
Module dependencies
- Service Container - patching required #2773731: Support for tags in Symfony service definitions parsed by PhpArrayDumper.
- Either Composer or Composer Manager to install Symfony EventDispatcher component.
Usage
- Register EventSubscriber class as a service by any understandable by Service Container method tagging service with event_subscriber tag.
- Dispatch an event with:
use Symfony\Component\EventDispatcher\EventSubscriberInterface; class EventSubscriber implements EventSubscriberInterface { public function methodName($event, $eventName, $eventDispatcher) { // Do something... } public static function getSubscribedEvents() { return array('eventName' => array('methodName')); } } $event = new Event(); $ed = Drupal::service('event_dispatcher'); $ed->dispatch('eventName', $event);
Project information
- Module categories: Performance, Integrations
- 2 sites report using this module
- Created by RoSk0 on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
7.x-1.0
released 2 August 2016
Works with Drupal: 7.x
✓ Recommended by the project’s maintainer.
Development version: 7.x-1.x-dev updated 2 Aug 2016 at 09:28 UTC