You are here

function lingotek_comment_view in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.7 lingotek.module \lingotek_comment_view()
  2. 7.2 lingotek.module \lingotek_comment_view()
  3. 7.3 lingotek.module \lingotek_comment_view()
  4. 7.5 lingotek.module \lingotek_comment_view()
  5. 7.6 lingotek.module \lingotek_comment_view()

Implements hook_comment_view().

File

./lingotek.module, line 1648

Code

function lingotek_comment_view($comment, $view_mode, $langcode) {
  if (class_exists('LingotekComment') && user_access('administer comments')) {
    $lingotek_comment = LingotekComment::load($comment);
    $link_token = drupal_get_token();
    if ($document_id = $lingotek_comment
      ->getMetadataValue('document_id')) {

      // This is a Lingotek-associated comment, present the "update translations" link.
      $comment->content['links']['comment']['#links']['comment-lingotek-refresh'] = array(
        'title' => t('refresh translations'),
        'href' => 'lingotek/sync/comment/' . $comment->cid,
        'html' => FALSE,
        'query' => array_merge(array(
          'token' => $link_token,
        ), drupal_get_destination()),
      );
    }
  }
  global $language;
  $comment->content['lingotek_link']['#markup'] = lingotek_workbench_icon('comment', $comment->cid, Lingotek::convertDrupal2Lingotek($language->language));
}