function lingotek_workbench_redirect in Lingotek Translation 7.4
Same name and namespace in other branches
- 7.5 lingotek.page.inc \lingotek_workbench_redirect()
- 7.6 lingotek.page.inc \lingotek_workbench_redirect()
1 string reference to 'lingotek_workbench_redirect'
- lingotek_menu in ./
lingotek.module - Implements hook_menu().
File
- ./
lingotek.page.inc, line 712 - Lingotek Tab for Nodes
Code
function lingotek_workbench_redirect($entity_type, $id, $lingotek_locale) {
$drupal_language_code = Lingotek::convertLingotek2Drupal($lingotek_locale);
if ($entity_type == 'node') {
// clear any residual nodes built out before the lingotek document_id was stored
if (module_exists('entitycache')) {
cache_clear_all($id, 'cache_entity_node');
}
$node = node_load($id);
if ($node->language == $drupal_language_code) {
drupal_goto('node/' . $node->nid . '/edit');
}
else {
$translation_edit_link = lingotek_get_workbench_url($node->lingotek['document_id'], $lingotek_locale);
drupal_goto($translation_edit_link);
}
}
elseif ($entity_type == 'comment') {
$comment = comment_load($id);
if ($comment->language == $drupal_language_code) {
drupal_goto('comment/' . $comment->cid . '/edit');
}
else {
$lingotek_comment = LingotekComment::load($comment);
$translation_edit_link = lingotek_get_workbench_url($lingotek_comment
->lingotekDocumentId(), $lingotek_locale);
if (!empty($translation_edit_link)) {
drupal_goto($translation_edit_link);
}
else {
drupal_goto('comment/' . $comment->cid . '/edit');
}
}
}
}