function nodereferrer_referrers_with_translations in NodeReferrer 6
Same name and namespace in other branches
- 7 views/nodereferrer.views.inc \nodereferrer_referrers_with_translations()
Given a node id, field names and content names, returns the list of nodes that refer to the given node. This takes translation settings into account
3 calls to nodereferrer_referrers_with_translations()
- nodereferrer_view_handler_argument::referrers in views/
nodereferrer_view_handler_argument.inc - Given a node id, field names and content names, returns the list of nodes that refer to the given node. This takes translation settings into account
- nodereferrer_view_handler_field::referrers in views/
nodereferrer_view_handler_field.inc - Given a node id, field names and content names, returns the list of nodes that refer to the given node. This takes translation settings into account
- nodereferrer_view_handler_filter::referrers in views/
nodereferrer_view_handler_filter.inc - Given a node id, field names and content names, returns the list of nodes that refer to the given node. This takes translation settings into account
File
- views/
nodereferrer.views.inc, line 103 - nodereferrer.module Views integration
Code
function nodereferrer_referrers_with_translations($nid, $fields, $types, $ref_of_trans, $trans_of_ref) {
if (!module_exists('translation')) {
return nodereferrer_referrers($nid, $fields, $types);
}
$ref = nodereferrer_referrers($nid, $fields, $types, $ref_of_trans);
if ($trans_of_ref && count($ref)) {
$in = implode(',', array_keys($ref));
$query = "SELECT node2.nid, node2.vid, node2.title\n FROM {node} node\n INNER JOIN {node} node2 on node2.tnid = node.tnid\n WHERE node.nid IN ({$in})\n AND\n node.tnid > 0\n ";
$query = db_rewrite_sql($query, 'node');
$result = db_query($query);
while ($value = db_fetch_array($result)) {
$ref[$value['nid']] = $value;
}
}
return $ref;
}