translation_node_get_translations
modules/translation/translation.module, строка 285
- Версии
- 6
translation_node_get_translations($tnid)
Get all nodes in a translation set, represented by $tnid
.
Параметры
$tnid
The translation source nid of the translation set, the identifier
of the node used to derive all translations in the set.
Возвращаемое значение
Array of partial node objects (nid, title, language) representing
all nodes in the translation set, in effect all translations
of node $tnid
, including node $tnid
itself. Because these are
partial nodes, you need to node_load() the full node, if you
need more properties. The array is indexed by language code.
Код
<?php
function translation_node_get_translations($tnid) {
static $translations = array();
if (is_numeric($tnid) && $tnid) {
if (!isset($translations[$tnid])) {
$translations[$tnid] = array();
$result = db_query(db_rewrite_sql('SELECT n.nid, n.title, n.language FROM {node} n WHERE n.tnid = %d'), $tnid);
while ($node = db_fetch_object($result)) {
$translations[$tnid][$node->language] = $node;
}
}
return $translations[$tnid];
}
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии