You are here

function hook_ENTITY_TYPE_update in Entity API 7

Act on entities when updated.

Parameters

$entity: The entity object.

See also

hook_entity_update()

3 functions implement hook_ENTITY_TYPE_update()

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

entity_test_entity_test_type_update in tests/entity_test.module
Implements hook_entity_test_type_update().
entity_test_entity_update in tests/entity_test.module
Implements hook_entity_update().
entity_test_i18n_entity_test_type_update in tests/entity_test_i18n.module
Implements hook_{entity_test_type}_update().

File

./entity.api.php, line 524
Hooks provided by the entity API.

Code

function hook_ENTITY_TYPE_update($entity) {

  // Update the entity's entry in a fictional table of all entities.
  $info = entity_get_info($type);
  list($id) = entity_extract_ids($type, $entity);
  db_update('example_entity')
    ->fields(array(
    'updated' => REQUEST_TIME,
  ))
    ->condition('type', $type)
    ->condition('id', $id)
    ->execute();
}