I am using entity_translation module for translating node titles. And with this Translate tab appears on node view like in screenshot.

enter image description here

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(&$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(&$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 ?


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

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

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

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


2 Answers 2


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().

  • Thanks for your answer, please see updated question. I did with menu_alter as well and entity_translation was having high priority but I made priority of my module high and weight of my module is 1000 but it still does not work.
    – jas
    Apr 1, 2016 at 15:45
function my_module_menu_local_tasks_alter(&$data, $router_item, $root_path) {
  global $user;

  foreach ($router_item['page_arguments'] as $key => $argument) {
    if (is_object($argument) && in_array($router_item['page_arguments'][$key]->type, array('link'))) {
      foreach ($data['tabs'][0]['output'] as $key => $value) {
        if ($value['#link']['path'] == 'node/%/translate') {
          if (add condition according to requirement) {

With this code I am able to unset Translate tab according to user roles. NOTE: "link" is my content type.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.