function lingotek_entity_translation_node_tab_access in Lingotek Translation 7.2
Same name and namespace in other branches
- 7.7 lingotek.module \lingotek_entity_translation_node_tab_access()
- 7.3 lingotek.module \lingotek_entity_translation_node_tab_access()
- 7.4 lingotek.module \lingotek_entity_translation_node_tab_access()
- 7.5 lingotek.module \lingotek_entity_translation_node_tab_access()
- 7.6 lingotek.module \lingotek_entity_translation_node_tab_access()
Entity Translation access callback when enabled with Lingotek module.
Return value
bool TRUE if the user should be able to access the requested resource, FALSE otherwise.
See also
entity_translation_node_tab_access().
1 string reference to 'lingotek_entity_translation_node_tab_access'
- lingotek_menu_alter in ./
lingotek.module - Implements hook_menu_alter().
File
- ./
lingotek.module, line 413
Code
function lingotek_entity_translation_node_tab_access() {
$args = func_get_args();
$node = array_shift($args);
if ($node->language !== LANGUAGE_NONE) {
if (lingotek_supported_type($node->type)) {
// If the node has been pushed then return FALSE (don't show the "Translate" tab)
// Otherwise, return TRUE (show the "Translate" tab)
$user_access = drupal_multilingual() && (user_access('translate any entity') || user_access("translate node entities"));
$translate_tab_access = lingotek_managed_by_entity_translation($node->type) && !lingotek_node_pushed($node) && $user_access;
return $translate_tab_access;
}
elseif (entity_translation_node_supported_type($node->type)) {
// This is not a Lingotek-supported type, but is a type
// that is set up for Entity Translation.
// Fall back to the Entity Translation module's access callback.
return entity_translation_tab_access('node', $node);
}
elseif (entity_translation_node('node', $node) && module_exists('translation')) {
// This node is set up to use the Translation module's
// node translation (as opposed to Entity Translation).
return _translation_tab_access($node);
}
}
return FALSE;
}