hook_entity_presave
function hook_entity_presave
hook_entity_presave(Drupal\Core\Entity\EntityInterface $entity)
Act on an entity before it is created or updated.
You can get the original entity object from $entity->original when it is an update of the entity.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity object.