You are here

function globallink_get_node_title in GlobalLink Connect for Drupal 7.6

Same name and namespace in other branches
  1. 7.5 globallink_node.inc \globallink_get_node_title()

Gets node title.

Parameters

object $globallink: A GlobalLink object.

Return value

string The title of the node.

3 calls to globallink_get_node_title()
globallink_dashboard_receive in ./globallink_receive_translations.inc
Builds form to receive a GlobalLink submission.
globallink_dashboard_receive_submit in ./globallink_receive_translations.inc
Handles GlobalLink form submission.
globallink_get_translated_content in ./globallink_node.inc
Gets translated content.

File

./globallink_node.inc, line 2132

Code

function globallink_get_node_title(&$globallink) {
  $result = db_select('globallink_core', 'tc')
    ->fields('tc')
    ->condition('document_ticket', $globallink->documentTicket, '=')
    ->condition('submission_ticket', $globallink->submissionTicket, '=')
    ->execute();
  foreach ($result as $item) {
    $nid = $item->nid;
    $node = node_load($nid, $item->vid);
    $globallink->nid = $nid;
    $globallink->vid = $item->vid;
    $globallink->tptRowId = $item->rid;
    $globallink->title = $item->title;
    switch ($item->status) {
      case 'Sent for Translations':
        $globallink->status = 'Translation Completed';
        break;
      case 'Error':
        $globallink->status = 'Error';
        break;
    }
    if (!$node || is_null($node) || !is_object($node)) {
      return FALSE;
    }
    else {
      $title = l(globallink_format_display_string($node->title), 'node/' . $item->nid);
      return $title;
    }
  }
  return FALSE;
}