You are here

function lingotek_node_load_default in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.3 lingotek.util.inc \lingotek_node_load_default()
  2. 7.4 lingotek.module \lingotek_node_load_default()
  3. 7.5 lingotek.module \lingotek_node_load_default()
  4. 7.6 lingotek.module \lingotek_node_load_default()

Lingotek custom wrapper function for node_load

This is needed because the Lingotek module should translate only the most current revision of any node

Parameters

$nid entity_id of node to load:

Return value

$node most current revision of the node at $nid

14 calls to lingotek_node_load_default()
lingotek_advanced_parsing_update_node in ./lingotek.module
Processing callback for the advanced parsing update batch operation.
lingotek_advanced_parsing_upgrade_form_submit in ./lingotek.page.inc
Submit handler for the lingotek_advanced_parsing_upgrade_form form.
lingotek_delete_node_translations in ./lingotek.util.inc
Delete translations for node based entities
lingotek_entity_changed in ./lingotek.util.inc
lingotek_entity_load_single in ./lingotek.module

... See full list

1 string reference to 'lingotek_node_load_default'
lingotek_entity_changed in ./lingotek.util.inc

File

./lingotek.module, line 1448

Code

function lingotek_node_load_default($nid, $vid = NULL, $reset = FALSE) {
  $nodes =& drupal_static(__FUNCTION__, array());
  if (!isset($nodes[$nid])) {
    if ($vid == NULL) {
      $query = db_select('node_revision', 'nr')
        ->condition('nid', $nid, '=');
      $query
        ->addExpression('MAX(vid)', 'max_vid');
      $vid = $query
        ->execute()
        ->fetchField();
    }
    $node = node_load($nid, $vid, $reset);
    $nodes[$nid] = $node;
  }
  return $nodes[$nid];
}