You are here

function lingotek_node_load_default in Lingotek Translation 7.4

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.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

25 calls to lingotek_node_load_default()
LingotekNode::loadById in lib/Drupal/lingotek/LingotekNode.php
Factory method for getting a loaded LingotekNode object.
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_comment_delete in ./lingotek.module
Implements hook_comment_delete().
lingotek_comment_update in ./lingotek.module
Implements hook_comment_update().

... See full list

File

./lingotek.module, line 1258

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;
}