You are here

function hook_ENTITY_TYPE_update in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/entity.api.php \hook_ENTITY_TYPE_update()

Respond to updates to an entity of a particular type.

This hook runs once the entity storage has been updated. Note that hook implementations may not alter the stored entity data.

Parameters

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

See also

hook_entity_update()

Related topics

41 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.

block_content_test_block_content_update in core/modules/block_content/tests/modules/block_content_test/block_content_test.module
Implements hook_block_content_update().
book_form_update in core/modules/book/book.module
Renders a new parent page select element when the book selection changes.
book_node_type_update in core/modules/book/book.module
Implements hook_ENTITY_TYPE_update() for node_type entities.
book_node_update in core/modules/book/book.module
Implements hook_ENTITY_TYPE_update() for node entities.
comment_field_config_update in core/modules/comment/comment.module
Implements hook_ENTITY_TYPE_update() for 'field_config'.

... See full list

File

core/lib/Drupal/Core/Entity/entity.api.php, line 998
Hooks and documentation related to entities.

Code

function hook_ENTITY_TYPE_update(Drupal\Core\Entity\EntityInterface $entity) {

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