You are here

function pmpapi_push_entity_update in Public Media Platform API Integration 7

Implements hook_entity_update().

File

pmpapi_push/pmpapi_push.module, line 153
Maps drupal entities to MPM profiles, and pushes them to the PMP API.

Code

function pmpapi_push_entity_update($entity, $type) {
  if (pmpapi_push_entity_ok_to_push($entity, $type)) {
    $mapping = pmpapi_push_get_mapping_for_entity($entity, $type);
    $uname = pmpapi_push_get_uname($entity, $type);
    $mapped_profile = variable_get('pmpapi_push_' . $uname . '_profile');
    pmpapi_push_push_entity_to_pmp($entity, $type, $mapped_profile, $mapping);
  }
  elseif (isset($entity->status) && !$entity->status && $type != 'file' && !empty($entity->pmpapi_guid) && empty($entity->pmpapi_do_not_remove)) {
    pmpapi_remove($entity->pmpapi_guid);
  }
}