Module which dispatches events for entity create, update, delete.
Provides abstract classes for event listeners for you to extend in your own modules to 'do stuff' on entity operations. Can use as a replacement for hook_entity_[update/insert/delete] from within your module file.
Abstract classes:
EntityEventSubscriber
EntityEventInsertSubscriber
EntityEventUpdateSubscriber
EntityEventDeleteSubscriber
EntityEventPredeleteSubscriber
EntityEventPresaveSubscriber
Extend these classes with your own module subscribers.
Example implementation
namespace Drupal\mymodule\EventSubscriber;
use Drupal\entity_events\Event\EntityEvent;
use Drupal\entity_events\EventSubscriber\EntityEventInsertSubscriber;
class MyModuleSubscriber extends EntityEventInsertSubscriber {
public function onEntityInsert(EntityEvent $event) {
// Implement your logic here.
}
}
Remember to add event listeners to your services.yml.file
e.g.
services:
mymodule.subscriber:
class: Drupal\mymodule\EventSubscriber\MyModuleSubscriber
tags:
- {name: event_subscriber}Drupal Core since 11.1 supports hooks in classes out of the box. See change record here https://www.drupal.org/node/3442349 . It is strongly recommended to use the core feature instead of this module.
Similar modules:
Supporting organizations:
Project information
Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed.- Project categories: Content editing experience, Decoupled, Site structure
1,146 sites report using this module
- Created by mattgill on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.

