You are here

function lingotek_render_source in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lingotek.bulk_grid.inc \lingotek_render_source()
2 calls to lingotek_render_source()
lingotek_bulk_grid_parse_config_data in ./lingotek.config.inc
lingotek_bulk_grid_parse_table_data in ./lingotek.bulk_grid.inc

File

./lingotek.bulk_grid.inc, line 1734

Code

function lingotek_render_source($entity_type, $row, $icon, $languages, $language_col) {
  if ($entity_type == 'node') {
    $id = $row->nid;
  }
  elseif ($entity_type == 'comment') {
    $id = $row->cid;
  }
  elseif ($entity_type == 'config') {
    $id = $row->lid;
  }
  elseif ($entity_type == 'taxonomy_term') {
    $id = $row->tid;
    $row->language = isset($row->translation_mode) && $row->translation_mode == '1' ? 'en' : $row->language;
  }
  elseif (!empty($row->id)) {
    $id = $row->id;
  }
  $source = '<span class="lingotek-language-source" style="white-space: nowrap;">' . $icon . ' ';
  $source .= $language_col ? lingotek_get_upload_string($row, $languages) : '';
  $source .= '</span>';
  $linked_statuses = array(
    LingotekSync::STATUS_EDITED,
    LingotekSync::STATUS_FAILED,
  );
  $needs_upload = (in_array($row->upload_status, $linked_statuses) || empty($row->upload_status)) && $row->lingotek['profile'] != LingotekSync::PROFILE_DISABLED;
  if ($needs_upload) {

    // add link for upload
    $source = '<span title="Upload Now" class="ltk-upload-button lingotek-language-source" onclick="lingotek_perform_action(' . $id . ',\'upload\')">' . $source . '</span>';
  }
  return $source;
}