How to change MENU_LOCAL_TASK title for the View and Edit tabs according to content type? I am trying to change the title ( tab text ) of the standard Drupal menu local task tabs 'View' and 'Edit'.  I want them to reflect the content type of the current node.  So on the page node/1234 ( which is a blog node, say ) I want the View tab to say 'View blog' etc.

I can change the text using :

$items['node/%node/view']['title'] = 'View blog';


in a hook_menu_alter() function, but I can't seem to get hold of the node itself to test what content type it is to vary the text.  The arg() function doesn't return anything within the hook_menu_alter() function for some reason ?

How do I do this ?

Thanks
hook_menu() implementations are cached so aren't executed for every page (can you imagine how bad that would be for performance?)

You can use the title callback property from hook_menu() to evaluate a title on each page load, e.g.

$items['node/%node/view']['title callback'] = 'MYMODULE_title_callback';
$items['node/%node/view']['title arguments'] = array(1);

...

function MYMODULE_title_callback($node) {
  if ($node-&gt;type == 'foo') {
    return 'bar';
  }
  else {
    return 'baz';
  }
}