Act on entities when inserted.
Drupal\Core\Entity\EntityInterface $entity: The entity object.
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
function hook_entity_insert(Drupal\Core\Entity\EntityInterface $entity) {
// Insert the new entity into a fictional table of all entities.
db_insert('example_entity')
->fields(array(
'type' => $entity
->entityType(),
'id' => $entity
->id(),
'created' => REQUEST_TIME,
'updated' => REQUEST_TIME,
))
->execute();
}