You are here

function globallink_entity_get_title in GlobalLink Connect for Drupal 7.6

Same name and namespace in other branches
  1. 7.5 globallink_entity/globallink_entity.inc \globallink_entity_get_title()

Gets entity title

Parameters

object $globallink: GlobalLink object.

Return value

The entity title. FALSE if it cannot be found.

1 call to globallink_entity_get_title()
globallink_entity_receive_form in globallink_entity/globallink_entity_receive.inc
Builds form to receive an entity submission.

File

globallink_entity/globallink_entity.inc, line 1748

Code

function globallink_entity_get_title(&$globallink) {
  $result = db_select('globallink_core_entity', 'tc')
    ->fields('tc')
    ->condition('document_ticket', $globallink->documentTicket, '=')
    ->condition('submission_ticket', $globallink->submissionTicket, '=')
    ->execute();
  foreach ($result as $item) {
    $nid = $item->nid;
    $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;
    }
    return l(globallink_format_display_string($globallink->title), 'node/' . $item->nid);
  }
  return FALSE;
}