You are here

function lingotek_node_get_translations in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 6 lingotek.api.inc \lingotek_node_get_translations()

Gets all nodes in a given translation set without using node_access tag. This function is just a copy of translation module's translation_node_get_translations() function but with the addTag('node_access') removed.

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.

3 calls to lingotek_node_get_translations()
lingotek_entity_view_redirect in ./lingotek.page.inc
This is a function that redirects to the entity specified for a particular lingotek locale (e.g., en_US, de_DE, fr_FR)
lingotek_get_languages in ./lingotek.util.inc
lingotek_get_target_node in ./lingotek.remote.inc

File

./lingotek.module, line 3052

Code

function lingotek_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)
        ->execute();
      foreach ($result as $node) {
        $langcode = entity_language('node', $node);
        $translations[$tnid][$langcode] = $node;
      }
    }
    return $translations[$tnid];
  }
}