You are here

function votingapi_entity_delete in Voting API 7.2

Same name and namespace in other branches
  1. 8.3 votingapi.module \votingapi_entity_delete()
  2. 7.3 votingapi.module \votingapi_entity_delete()

Implements hook_entity_delete().

Delete all votes and cache entries for the deleted entities

File

./votingapi.module, line 683
A generalized voting API for Drupal.

Code

function votingapi_entity_delete($entity, $type) {
  $ids = entity_extract_ids($type, $entity);

  // We will use "Primary/Revision ID of the entity" only.
  if (count($ids) > 1) {
    $id = array(
      $ids[0],
      $ids[1],
    );
  }
  else {
    $id = array(
      $ids[0],
    );
  }
  _votingapi_delete_cache_by_entity($id, $type);
  _votingapi_delete_votes_by_entity($id, $type);
}