0

I have created a menu from the Drupal CMS (admin > structure > menu). Now I want to change the title of the same programatically. Is it possible, if so how?

I have tried hook_menu_alter, hook_menu_link_alter etc. but apparently most of them are only fetching the menus that are created using hook_menu. Am I missing something here?

I hope I am clear with my query.

Thanks,

6
  • 2
    But why? Why can't you simply edit that title in menu settings? Also, what title? By default menus don't have titles, they are menus, not blocks.
    – Mołot
    Commented Jan 21, 2014 at 12:22
  • The menu title is most likely in the theme. Menu's do not have titles that are controlled nor displayed from data with in Drupal core. Check your theme page tpl file. Commented Jan 21, 2014 at 20:10
  • By title I mean the display title of the menu, i.e. the name. I want to dynamically change it to something. For example, say in my case, I want to show the unread private message count with the menu like "Messages (2)". Now I can get this count using the private message apis and will like to display the same in the above format. Hope this clears up a little bit. Commented Jan 22, 2014 at 5:15
  • Never mind my situation. That is better to be done with blocks. But what if somehow I want to change a menu programatically? I cant think of an example however, but isnt it an obvious requirement? Commented Jan 22, 2014 at 8:58
  • You should only ask practical, answerable questions based on actual problems that you face. - if you cant think of example, don't ask here. Also, be sure to play with Examples for Developers.
    – Mołot
    Commented Jan 22, 2014 at 11:19

0

Your Answer

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

Browse other questions tagged or ask your own question.