You are here

function lingotek_menu_alter in Lingotek Translation 7.6

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

Implements hook_menu_alter().

File

./lingotek.module, line 507

Code

function lingotek_menu_alter(&$items) {

  // If set, allow nodes that are not associated with Lingotek to be
  // translated using Entity Translation's tools.
  if (!variable_get('lingotek_always_show_translate_tabs', FALSE)) {
    $translate_path = 'node/%node/translate';
    $lingotek_access_callback = 'lingotek_entity_translation_node_tab_access';
    if (isset($items[$translate_path])) {
      $items[$translate_path]['title'] = 'Translate';
      $items[$translate_path]['access callback'] = $lingotek_access_callback;
    }
    $menu_targets = array(
      'node/%node/translate/add/%entity_translation_language/%entity_translation_language',
      'node/%node/translate/delete/%entity_translation_language',
    );
    foreach ($menu_targets as $target) {
      if (isset($items[$target])) {
        $items[$target]['access callback'] = $lingotek_access_callback;
      }
    }
    $edit_target = 'node/%node/translate/edit/%entity_translation_language';
    if (isset($items[$edit_target])) {
      $items[$edit_target]['access callback'] = 'lingotek_entity_translation_edit_access';
      $items[$edit_target]['access arguments'][3] = $lingotek_access_callback;
    }
  }
}