You are here

function entity_translation_tab_access in Entity Translation 7

Access callback.

3 calls to entity_translation_tab_access()
entity_translation_handler_field_translate_link::render_link in views/entity_translation_handler_field_translate_link.inc
Render the link to the translation overview page of the entity.
entity_translation_node_tab_access in ./entity_translation.node.inc
Node specific access callback.
entity_translation_taxonomy_term_tab_access in ./entity_translation.taxonomy.inc
Taxonomy term specific access callback.
2 string references to 'entity_translation_tab_access'
entity_translation_entity_info_alter in ./entity_translation.module
Implements hook_entity_info_alter().
entity_translation_menu_alter in ./entity_translation.module
Implements hook_menu_alter().

File

./entity_translation.module, line 753

Code

function entity_translation_tab_access($entity_type, $entity) {
  if (drupal_multilingual() && (user_access('translate any entity') || user_access("translate {$entity_type} entities"))) {
    $handler = entity_translation_get_handler($entity_type, $entity);

    // Ensure $entity holds an entity object and not an id.
    $entity = $handler
      ->getEntity();
    $enabled = entity_translation_enabled($entity_type, $entity);
    return $enabled && $handler
      ->getLanguage() != LANGUAGE_NONE;
  }
  return FALSE;
}