function lingotek_get_fc_parent in Lingotek Translation 7.7
Same name and namespace in other branches
- 7.4 lingotek.module \lingotek_get_fc_parent()
- 7.5 lingotek.module \lingotek_get_fc_parent()
- 7.6 lingotek.module \lingotek_get_fc_parent()
1 call to lingotek_get_fc_parent()
File
- ./
lingotek.module, line 2202
Code
function lingotek_get_fc_parent($entity) {
$query = new EntityFieldQuery();
$query
->fieldCondition($entity
->fieldInfo(), 'revision_id', $entity->revision_id);
if (!$entity
->isInUse()) {
$query
->age(FIELD_LOAD_REVISION);
}
$result = $query
->execute();
$num_results = isset($result) ? count($result) : 0;
if (!isset($result) || $num_results != 1) {
return NULL;
}
foreach ($result as $parent_type => $parents) {
foreach (array_keys($parents) as $parent_id) {
return lingotek_entity_load_single($parent_type, $parent_id);
}
}
}