function lingotek_menu_alter in Lingotek Translation 7.2
Same name and namespace in other branches
- 7.7 lingotek.module \lingotek_menu_alter()
- 7.3 lingotek.module \lingotek_menu_alter()
- 7.4 lingotek.module \lingotek_menu_alter()
- 7.5 lingotek.module \lingotek_menu_alter()
- 7.6 lingotek.module \lingotek_menu_alter()
Implements hook_menu_alter().
File
- ./
lingotek.module, line 358
Code
function lingotek_menu_alter(&$items) {
// If the Entity Translation module is enabled alongside Lingotek,
// allow nodes that haven't yet been associated with Lingotek to be
// translated using Entity Translation's tools.
if (module_exists('entity_translation')) {
$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;
}
}
}