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

Project Usage
286
Creation Date
Changed Date
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

OPENAI CHATBOT

OPENAI CHATBOT

12:25:32
Generic Chatbot
Hi, I'm a Drupal module expert powered by OpenAI, answering your questions about the Drupal module ecosystem. How can I be helpful today? Please note that we will log your question.