I'm trying to alter tab names ("view current" and "edit current") but it is just not working.

function MY_MODULE_custom_menu_alter(&$items) {
    $items['node/%node/view']['title'] = t('View Event');
    $items['node/%node/edit']['title'] = t('Edit Event');

Module implementation is good. Cache is cleared. Tried it milion times, but still nothing!

Wondering is it possible that this code is being overriden somewhere, and how can I check that?

  • Are you positive the function is named right? What's the name of your function (as it is in your code), and what's the filename of the .module file? If you chuck a drupal_set_message('blah'); in, and clear the caches through the UI, do you see the message?
    – Clive
    Nov 8, 2013 at 18:07
  • @Clive my naming convention is correct. (Function name is: entity_registration_custom_menu_alter and module name is: entity_registration_custom.module). Module is working. When I set drupal_set_message('blah'); in hook_menu_alter and clear cache, I see msg however only here: /admin/config/development/performance.
    – Antonio
    Nov 8, 2013 at 18:18
  • That makes sense - hook_menu_alter() will only be invoked when the caches are cleared (not on every page). The hook's definitely firing then, so it's something else.
    – Clive
    Nov 8, 2013 at 18:22
  • Did you maybe forget to include the "&" in "&$items" in the actual function declaration? I know I've done that more than once.
    – Les Lim
    Nov 8, 2013 at 22:05
  • No, I didn't forget to include a reference.
    – Antonio
    Nov 9, 2013 at 13:58

4 Answers 4


If your hook implementation is definitely being fired then it does seem likely that another module (or even a theme, potentially) is overriding your changes.

To ensure your module's implementation runs last, you can implement hook_module_implements_alter():

function MYMODULE_module_implements_alter(&$implementations, $hook) {
  if ($hook == 'menu_alter') {
    $group = $implementations['my_module'];
    $implementations['my_module'] = $group;

If that isn't the problem, it might be something simpler...if your code is copied verbatim then you're setting the title twice for the same path. You might have meant

$items['node/%node/view']['title'] = t('View Event');

Or it might even be a combination of both of those.

  • Thx! Tried with this hook, but no effect whatsoever.
    – Antonio
    Nov 8, 2013 at 21:04
  • Hmmm something strange then. Double check there are no typos in your code, and then try Les Lim's answer. That'll give you a better idea what's going on
    – Clive
    Nov 8, 2013 at 22:01

The {menu_router} table contains the compiled result of hook_menu() and hook_menu_alter() implementations throughout your enabled modules. You can look at the entry for "node/%/edit" to see what's actually stored there for the "title" column; if it's "Edit Event", then your code is fine, and your problem is elsewhere.

If you suspect another hook_menu_alter() implementation is overriding you, you might try to grep for "node/%node/edit" throughout your codebase. You might also see if you have any Views page displays that are set with a path of "node/%/edit" - Views registers those routes programmatically using hook_menu_alter().

  • Les yes, I use Views page display to render a custom content type (events). I've also noticed that on built-in entities I see "View" and "Edit" titles in tabs, but on custom node types I see "View current" and "Edit current". So it seems that Views are overiding my hook_menu_alter. How do I remedy that? Can you give me more details? Thx!
    – Antonio
    Nov 9, 2013 at 3:00

All right guys, I fixed it by installing Tab Name Tweaker module.

I still do not understand what is wrong with my code though. Note that Tab name tweaker module did not work all until I removed my custom hook_menu_alter(). That leads to conclusion that something must be wrong with this implementation:

    function MY_MODULE_menu_alter(&$items) {
        $items['node/%node/view']['title'] = t('Blah View');
        $items['node/%node/edit']['title'] = t('Blah Edit'); 

I had also installed Modules Weight module, and tried putting my custom module at the end of list. No effect!

And even more strange, I use exactly the same code above to alter User profile tabs (in separate module), and it works there. Go figure out that! Insane!


Once I have the same problem and I solved it in an ugly way, but it works. I think that @Clive is right, some module is overriding your implementation so basically you have to update the module weight to run it at the end. To do it you can run:

update schema.system set weight = '99' WHERE name = "MODULE_NAME";

If this is working, you may look for some hooks to change the module weight.

  • Thx Ivan! Just FYI there is a module "Modules Weight" that allows for changing modules' weight through UI. Very handy! pozz! :)
    – Antonio
    Nov 9, 2013 at 16:13

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.