Module Description
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:
* Hook Event Dispatcher
* Hux
* Hooks
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:
* Hook Event Dispatcher
* Hux
* Hooks
Module Link
Project Usage
286
Security Covered
Covered By Security Advisory
Version Available
Production
Module Summary
This module aims to solve the dispatching of events for entity create, update, and delete operations by providing abstract classes for event listeners to extend in custom modules.
Data Name
entity_events