function hook_entity_presave

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

Parameters

Drupal\Core\Entity\EntityInterface $entity: The entity object.

Related topics

1 function implements hook_entity_presave()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

entity_crud_hook_test_entity_presave in drupal/core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module
Implements hook_entity_presave().
3 invocations of hook_entity_presave()
ConfigStorageController::save in drupal/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php
Implements Drupal\Core\Entity\EntityStorageControllerInterface::save().
DatabaseStorageController::save in drupal/core/lib/Drupal/Core/Entity/DatabaseStorageController.php
Implements Drupal\Core\Entity\EntityStorageControllerInterface::save().
DatabaseStorageControllerNG::save in drupal/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php
Overrides DatabaseStorageController::save().

File

drupal/core/includes/entity.api.php, line 81
Hooks provided the Entity module.

Code

function hook_entity_presave(Drupal\Core\Entity\EntityInterface $entity) {
  $entity->changed = REQUEST_TIME;
}