hook_entity_presave

  1. drupal
    1. 8 entity.api.php
    2. 7
Versions
8 – 7 hook_entity_presave($entity, $type)

Act on an entity before it is about to be created or updated.

Parameters

$entity The entity object.

$type The type of entity being saved (i.e. node, user, comment).

Related topics

Code

modules/system/system.api.php, line 295

<?php
function hook_entity_presave($entity, $type) {
  $entity->changed = REQUEST_TIME;
}
?>