You are here

function pmpapi_pull_entity_delete in Public Media Platform API Integration 7

Implements hook_entity_delete().

File

pmpapi_pull/pmpapi_pull.module, line 247
Allows admins to pull content from the PMP API, and turn PMP docs into (locally-stored, independent) drupal entities.

Code

function pmpapi_pull_entity_delete($entity, $type) {
  if (!empty($entity->pmpapi_guid) && pmpapi_pull_doc_has_been_pulled($entity->pmpapi_guid)) {
    db_delete('pmpapi_pull_pulled_docs')
      ->condition('guid', $entity->pmpapi_guid)
      ->execute();

    // Entity is gone, but other hooks still might try to remove this doc from
    // the PMP API. This property will prevent that.
    $entity->pmpapi_do_not_remove = TRUE;
  }
}