How to override menu Item? I am using entity_translation module for translating node titles. And with this Translate tab appears on node view like in screenshot.



I am trying to override titles and access permissions for this menu tab and found that its coded in /sites/all/modules/entity_translation/entity_translation.node.inc like below:

/**
 * Node-specific menu alterations.
 */
function entity_translation_node_menu_alter(&amp;$items, $backup) {
  if (isset($backup['node'])) {
    $item = $backup['node'];
    // Preserve the menu router item defined by other modules.
    $callback['page callback'] = $item['page callback'];
    $callback['file'] = $item['file'];
    $callback['module'] = $item['module'];
    $access_arguments = array_merge(array(1, $item['access callback']), $item['access arguments']);
  }
  else {
    $callback = FALSE;
    $access_arguments = array(1);
  }


  $items['node/%node/translate']['page callback'] = 'entity_translation_overview';
  $items['node/%node/translate']['page arguments'] = array('node', 1, $callback);
  $items['node/%node/translate']['access arguments'] = $access_arguments;
  $items['node/%node/translate']['access callback'] = 'entity_translation_node_tab_access';
  $items['node/%node/translate']['file'] = 'entity_translation.admin.inc';
  $items['node/%node/translate']['module'] = 'entity_translation';
}


In my custom module I tried overriding like this:

function my_module_node_menu_alter(&amp;$items, $backup) {
  $items['node/%node/translate']['title'] = "My New Title";
  $items['node/%node/translate']['access callback'] = 'my_module_transaltion_access';

}

function my_module_transaltion_access(){
   // code for my permissions according to user roles. 
}


But I am not able to alter this menu item. Please suggest what is right way to do this ?

UPDATE:

function my_module_menu_alter(&amp;$menu,&amp;$items) {

   $items['node/%node/translate']['access callback'] = "my_module_transaltion_access";
}

function my_module_implements_alter(&amp;$implementations, $hook) {
  switch ($hook) {
    case 'menu_alter':

      // Move some of our hook implementations to the end of the list.
      $group = $implementations['my_module'];
      unset($implementations['my_module']);
      $implementations['my_module'] = $group;
      break;
  }
}


Thanks!
Try hook_menu_alter() to alter the menu,  https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_menu_alter/7.

Moreover, entity_translation_node_menu_alter() is not a hook and it is a function called from entity_translation_menu_alter().