function translation_node_get_translations
translation_node_get_translations($tnid)
Gets all nodes in a given translation set.
Parameters
$tnid: The translation source nid of the translation set, the identifier of the node used to derive all translations in the set.
Return value
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.
File
- modules/translation/translation.module, line 486
- Manages content translations.
Code
function translation_node_get_translations($tnid) { if (is_numeric($tnid) && $tnid) { $translations = &drupal_static(__FUNCTION__, array()); if (!isset($translations[$tnid])) { $translations[$tnid] = array(); $result = db_select('node', 'n') ->fields('n', array('nid', 'type', 'uid', 'status', 'title', 'language')) ->condition('n.tnid', $tnid) ->addTag('node_access') ->execute(); foreach ($result as $node) { $langcode = entity_language('node', $node); $translations[$tnid][$langcode] = $node; } } return $translations[$tnid]; } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!translation!translation.module/function/translation_node_get_translations/7.x