Drupal Module Add Menu Item To Primary Links?

亡梦爱人 提交于 2020-01-14 10:15:52

问题


Is it possible to add a menu item from within hook_menu() directly to the primary-links menu instead of navigation where they like to reside by default?


回答1:


Actually, it is possible. One of the optional keys in a hook_menu() implementation is in fact 'menu_name', and its value can be the unique name of a given menu. In your case, 'primary-links'. The Devel module uses that technique to add its items to a custom 'Development' menu.

Also note that versions of Drupal 6 earlier than 6.6 (IIRC) had a bug that made it impossible to move a menu item already defined in hook_menu() simply by changing the hook_menu() implementation -- you had to explicitly edit the menu item in the UI to reparent it. Drupal 6.7 and later (again, going by memory) fixed that bug and hook_menu is all that's needed.



来源:https://stackoverflow.com/questions/1257234/drupal-module-add-menu-item-to-primary-links

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!