Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Entity Events

Security covered Under active development 1,286 sites

Part of the Entity ecosystem · 308 projects

This module dispatches events whenever an entity is created, updated, or deleted. It provides abstract classes that developers can extend to easily implement custom logic in response to these entity operations, serving as an alternative to using Drupal's traditional hooks.

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:

Drupal 10–11

Ask your assistant about Entity Events

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

1 tracked project depends on this one

Activity

Tracked releases
4
Tracked since
Dec 2023
Latest release
2 months ago
Releases (12 mo)
1 ▼ from 2
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
2.1.0 Stable 10–11 Jul 22, 2026
2.0.5 Stable 9–11 Jun 21, 2025
2.0.4 Stable 9–11 Jan 30, 2025
2.0.3 Stable 9–10 Dec 27, 2023