function lingotek_node_get_translations in Lingotek Translation 6
Same name and namespace in other branches
- 7.7 lingotek.module \lingotek_node_get_translations()
2 calls to lingotek_node_get_translations()
File
- ./
lingotek.api.inc, line 187
Code
function lingotek_node_get_translations($tnid) {
static $translations = array();
if (is_numeric($tnid) && $tnid) {
if (!isset($translations[$tnid])) {
$translations[$tnid] = array();
$query = 'SELECT n.nid, n.title, n.language FROM {node} n LEFT JOIN lingotek ln ON n.nid = ln.nid AND ln.{lingokey} = \'tnid\' WHERE n.tnid = %d OR ln.lingovalue = \'%d\'';
$result = db_query($query, $tnid, $tnid);
while ($node = db_fetch_object($result)) {
$translations[$tnid][$node->language] = $node;
}
}
$source = node_load(array(
'nid' => $tnid,
));
unset($translations[$tnid][$source->language]);
return $translations[$tnid];
}
}