Exemple #1
0
/**
 * Respond to entity deletion of a particular type.
 *
 * This hook runs once the entity has been deleted from the storage.
 *
 * @param \Drupal\Core\Entity\EntityInterface $entity
 *   The entity object for the entity that has been deleted.
 *
 * @ingroup entity_crud
 * @see hook_entity_delete()
 */
function hook_ENTITY_TYPE_delete(Drupal\Core\Entity\EntityInterface $entity)
{
    // Delete the entity's entry from a fictional table of all entities.
    db_delete('example_entity')->condition('type', $entity->getEntityTypeId())->condition('id', $entity->id())->execute();
}