You are here

function lingotek_entity_translation_node_tab_access in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.7 lingotek.module \lingotek_entity_translation_node_tab_access()
  2. 7.2 lingotek.module \lingotek_entity_translation_node_tab_access()
  3. 7.3 lingotek.module \lingotek_entity_translation_node_tab_access()
  4. 7.5 lingotek.module \lingotek_entity_translation_node_tab_access()
  5. 7.6 lingotek.module \lingotek_entity_translation_node_tab_access()

Entity Translation access callback when enabled with Lingotek Translation 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 500

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) || lingotek_managed_by_entity_translation($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 = $node->lingotek['profile'] == LingotekSync::PROFILE_DISABLED && $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;
}