function lingotek_is_node_translation in Lingotek Translation 7.6
Same name and namespace in other branches
- 7.7 lingotek.util.inc \lingotek_is_node_translation()
- 7.5 lingotek.util.inc \lingotek_is_node_translation()
Return the translation source node ID, if it exists, FALSE otherwise
Parameters
object $node:
Return value
mixed translation source node ID or FALSE if not node translation
2 calls to lingotek_is_node_translation()
- lingotek_form_node_form_alter in ./
lingotek.module - Implements hook_form_BASE_FORM_ID_alter().
- lingotek_get_node_settings_form in ./
lingotek.module - Display the Lingotek node-settings form
File
- ./
lingotek.util.inc, line 2005 - Utility functions.
Code
function lingotek_is_node_translation($node = NULL) {
// The case of creating a new node-based translation.
if (isset($_GET['translation']) && isset($_GET['target']) && lingotek_entity_load_single('node', (int) $_GET['translation'])) {
return $_GET['translation'];
}
// locate a translation source node ID, if available
$tnid = !empty($node->tnid) && $node->tnid !== $node->nid && $node->tnid !== 0 ? $node->tnid : NULL;
if (!$tnid) {
$tnid = !empty($node->translation_source->nid) && (empty($node->nid) || $node->nid !== $node->translation_source->nid && $node->nid !== 0) ? $node->translation_source->nid : NULL;
}
// The case of updating an existing node-based translation.
if ($tnid) {
return $tnid;
}
// Not a node-based translation.
return FALSE;
}