function rules_entity_update

Same name in other branches
  1. 7.x-2.x modules/events.inc \rules_entity_update()

Implements hook_entity_update().

File

./rules.module, line 175

Code

function rules_entity_update(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,
            $entity_type_id . '_unchanged' => $entity->original,
        ]);
        $event_dispatcher = \Drupal::service('event_dispatcher');
        $event_dispatcher->dispatch($event, "rules_entity_update:{$entity_type_id}");
    }
}