You are here

function rules_entity_delete in Rules 8.3

Same name and namespace in other branches
  1. 7.2 modules/events.inc \rules_entity_delete()

Implements hook_entity_delete().

3 string references to 'rules_entity_delete'
ActionsFormTest::dataActionsFormWidgets in tests/src/Functional/ActionsFormTest.php
Provides data for testActionsFormWidgets().
ContextIntegrationTest::testAssignmentRestriction in tests/src/Kernel/ContextIntegrationTest.php
Tests the assignment restriction on context definitions.
EntityDeleteTest::setUp in tests/src/Unit/Integration/RulesAction/EntityDeleteTest.php

File

./rules.module, line 148
Hook implementations for the Rules module.

Code

function rules_entity_delete(EntityInterface $entity) {

  // Only handle content entities and ignore config entities.
  if ($entity instanceof ContentEntityInterface) {
    $entity_type_id = $entity
      ->getEntityTypeId();
    $event = new EntityEvent($entity, [
      $entity_type_id => $entity,
    ]);
    $event_dispatcher = \Drupal::service('event_dispatcher');
    $event_dispatcher
      ->dispatch("rules_entity_delete:{$entity_type_id}", $event);
  }
}