You are here

public static function LingotekNode::loadByLingotekDocumentId in Lingotek Translation 7.2

Same name and namespace in other branches
  1. 7.3 lib/Drupal/lingotek/LingotekNode.php \LingotekNode::loadByLingotekDocumentId()
  2. 7.4 lib/Drupal/lingotek/LingotekNode.php \LingotekNode::loadByLingotekDocumentId()

Loads a LingotekNode by Lingotek Document ID.

Parameters

string $lingotek_document_id: The Document ID whose corresponding node should be loaded.

Return value

mixed A LingotekNode object on success, FALSE on failure.

File

lib/Drupal/lingotek/LingotekNode.php, line 120
Defines LingotekNode.

Class

LingotekNode
A class wrapper for Lingotek-specific behavior on nodes.

Code

public static function loadByLingotekDocumentId($lingotek_document_id) {
  $node = FALSE;
  $key = 'document_id';
  $query = db_select('lingotek', 'l')
    ->fields('l');
  $query
    ->condition('lingokey', $key . '%', 'LIKE');
  $query
    ->condition('lingovalue', $lingotek_document_id);
  $result = $query
    ->execute();
  if ($record = $result
    ->fetchAssoc()) {
    $node = self::loadById($record['nid']);
  }
  return $node;
}