function translation_node_get_translations in Internationalization 5.3
Same name and namespace in other branches
- 5 translation/translation.module \translation_node_get_translations()
- 5.2 translation/translation.module \translation_node_get_translations()
* Get translations
*
Parameters
$params: array of parameters * @param $getall TRUE to get the also node itself
5 calls to translation_node_get_translations()
- i18nsync_nodeapi in experimental/
i18nsync.module - Implementation of hook_nodeapi().
- translation_nodeapi in translation/
translation.module - Implementation of hook_nodeapi().
- translation_nodeapi_nat in translation/
translation.module - NAT (Node As Term) integration for node translations
- translation_node_prepare in translation/
translation.module - Prepare node for translation
- _i18nblocks_nodeasblock in i18nblocks/
i18nblocks.module - Helper function: collect translation nids and get related nodeasblock block
File
- translation/
translation.module, line 899
Code
function translation_node_get_translations($params, $getall = TRUE) {
foreach ($params as $field => $value) {
$conds[] = "b.{$field} = '%s'";
$values[] = $value;
}
if (!$getall) {
// If not all, a parameter must be nid
$conds[] = "n.nid <> %d";
$values[] = $params['nid'];
}
$conds[] = "b.trid <> 0";
$sql = 'SELECT n.nid, n.title, n.status, a.language FROM {node} n INNER JOIN {i18n_node} a ON n.nid = a.nid INNER JOIN {i18n_node} b ON a.trid = b.trid WHERE ' . implode(' AND ', $conds);
i18n_selection_mode('off');
$result = db_query(db_rewrite_sql($sql), $values);
i18n_selection_mode('reset');
$items = array();
while ($node = db_fetch_object($result)) {
$items[$node->language] = $node;
}
return $items;
}