function pmpapi_entity_load in Public Media Platform API Integration 7
Implements hook_entity_load().
File
- ./
pmpapi.module, line 440 - Creates basic calls to the PMP API.
Code
function pmpapi_entity_load($entities, $type) {
foreach ($entities as $entity) {
$ids = entity_extract_ids($type, $entity);
$entity_id = $ids[0];
$pmp_info = db_query("SELECT guid, permissions FROM {pmpapi_local_docs} WHERE entity_type=:entity_type AND entity_id=:id", array(
':entity_type' => $type,
':id' => $entity_id,
))
->fetchAssoc();
if (!empty($pmp_info['guid'])) {
$entity->pmpapi_guid = $pmp_info['guid'];
$entity->pmpapi_permissions = unserialize($pmp_info['permissions']);
$entity->pmpapi_permissions_added = TRUE;
}
}
}