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
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) {
drupal_set_message('Entity inserted ');
}
}
Remember to add event listeners to your services.yml.file
e.g.
services:
mymodule.subscriber:
class: Drupal\mymodule\EventSubscriber\MyModuleSubscriber
tags:
- {name: event_subscriber}
There is also Drupal Core issue to implement similar functionality in Core: #2551893: Add events for matching entity hooks
Similar modules:
Supporting organizations:
Project information
- Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed. - Module categories: Content Editing Experience, Decoupled, Site Structure
- 442 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.