function lingotek_menu_alter in Lingotek Translation 7.7
Same name and namespace in other branches
- 7.2 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 537
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;
}
}
}