You are here

function lingotek_render_title in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lingotek.bulk_grid.inc \lingotek_render_title()
1 call to lingotek_render_title()
lingotek_bulk_grid_parse_table_data in ./lingotek.bulk_grid.inc

File

./lingotek.bulk_grid.inc, line 1706

Code

function lingotek_render_title($row, $entity_properties, $language) {
  $info = $entity_properties['info'];
  $entity_type = $entity_properties['type'];
  $no_localized_title = language_default()->language != $language->language && (!isset($row->localized_title) or $row->localized_title == '');

  // special handling of taxonomy terms for URI generation
  if ($entity_type == 'taxonomy_term') {
    $term_obj = lingotek_entity_load_single($entity_type, $row->tid);
    $uri = isset($info['uri callback']) ? call_user_func($info['uri callback'], $term_obj) : '';
  }
  else {
    $uri = isset($info['uri callback']) ? call_user_func($info['uri callback'], $row) : '';
  }
  $uri['options']['attributes'] = array(
    'target' => '_blank',
  );
  $title_to_show = isset($row->localized_title) ? $row->localized_title : $row->title;
  $title = $no_localized_title ? '<span class="no-localized-title">' : '';
  if (isset($uri['path'])) {
    $title .= l($title_to_show, $uri['path'], $uri['options']);
  }
  else {
    $title .= $title_to_show;
  }
  $title .= $no_localized_title ? '</span>' : '';
  return $title;
}