function rules_entity_insert in Rules 8.3
Same name and namespace in other branches
- 7.2 modules/events.inc \rules_entity_insert()
Implements hook_entity_insert().
File
- ./
rules.module, line 161 - Hook implementations for the Rules module.
Code
function rules_entity_insert(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_insert:{$entity_type_id}", $event);
}
}