You are here

function lingotek_node_load_default in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lingotek.module \lingotek_node_load_default()
  2. 7.3 lingotek.util.inc \lingotek_node_load_default()
  3. 7.4 lingotek.module \lingotek_node_load_default()
  4. 7.5 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

13 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_entity_changed in ./lingotek.util.inc
lingotek_entity_load_single in ./lingotek.module
lingotek_form_node_form_alter in ./lingotek.module
Implements hook_form_BASE_FORM_ID_alter().

... See full list

File

./lingotek.module, line 1374

Code

function lingotek_node_load_default($nid, $vid = NULL, $reset = FALSE) {
  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);
  return $node;
}