function lingotek_comment_view in Lingotek Translation 7.5
Same name and namespace in other branches
- 7.7 lingotek.module \lingotek_comment_view()
- 7.2 lingotek.module \lingotek_comment_view()
- 7.3 lingotek.module \lingotek_comment_view()
- 7.4 lingotek.module \lingotek_comment_view()
- 7.6 lingotek.module \lingotek_comment_view()
Implements hook_comment_view().
File
- ./
lingotek.module, line 1782
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()),
);
}
}
if (user_access('translation') && isset($comment->lingotek['profile']) && $comment->lingotek['profile'] != LingotekSync::PROFILE_DISABLED && !empty($comment->lingotek['last_uploaded']) && !empty($comment->lingotek['document_id'])) {
global $language;
$comment->content['lingotek_link']['#markup'] = lingotek_workbench_icon('comment', $comment->cid, Lingotek::convertDrupal2Lingotek($language->language));
}
}