function lingotek_node_view in Lingotek Translation 7.4
Same name and namespace in other branches
- 6 lingotek.module \lingotek_node_view()
- 7.7 lingotek.module \lingotek_node_view()
- 7.2 lingotek.module \lingotek_node_view()
- 7.3 lingotek.module \lingotek_node_view()
- 7.5 lingotek.module \lingotek_node_view()
- 7.6 lingotek.module \lingotek_node_view()
Implements hook_node_view().
File
- ./
lingotek.module, line 1122
Code
function lingotek_node_view($node, $view_mode) {
global $language, $first_load, $user;
$lingotek_document_id = isset($node->lingotek['document_id']) ? $node->lingotek['document_id'] : NULL;
$community_translation_allowed = isset($node->lingotek['allow_community_translation']) ? $node->lingotek['allow_community_translation'] : FALSE;
if ($view_mode == 'full' && $community_translation_allowed && $lingotek_document_id && lingotek_supported_type($node->type) && Lingotek::isSupportedLanguage($node->language)) {
if ($language->language != $node->language) {
$link = lingotek_get_workbench_url($node->lingotek['document_id'], $language->lingotek_locale, t('Help make it better.'));
if ($link != '') {
$message = t('The translation of this page is still being worked on.') . " ";
$message .= $link . ' ';
if (lingotek_access($node, 'manage projects')) {
$message .= '<span style="font-size: 80%">[' . l(t('progress'), 'node/' . $node->nid . '/lingotek_pm', array(
'html' => TRUE,
)) . ']</span>';
}
drupal_set_message($message, 'warning', FALSE);
}
}
}
if (user_access('translation')) {
if (isset($node->lingotek['document_id']) && !empty($node->lingotek['document_id'])) {
global $language;
$node->content['lingotek_link']['#markup'] = lingotek_workbench_icon('node', $node->nid, Lingotek::convertDrupal2Lingotek($language->language));
}
}
}