function lingotek_comment_view in Lingotek Translation 7.7
Same name and namespace in other branches
- 7.2 lingotek.module \lingotek_comment_view()
- 7.3 lingotek.module \lingotek_comment_view()
- 7.4 lingotek.module \lingotek_comment_view()
- 7.5 lingotek.module \lingotek_comment_view()
- 7.6 lingotek.module \lingotek_comment_view()
Implements hook_comment_view().
File
- ./
lingotek.module, line 2149
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()),
);
}
else {
$document_id = '';
}
}
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($document_id, Lingotek::convertDrupal2Lingotek($language->language));
}
}