Drupal $tabs not including edit / revisions / workflow

天大地大妈咪最大 提交于 2019-12-04 18:18:05

The $tabs variable normally gets populated with menu entries of type MENU_LOCAL_TASK.

Take a look at the menu system, and especially at hook_menu() to get a basic idea. It boils down to a mapping of callback functions to paths. If an URL matches a path defined in hook_menu (can contain placeholders!), the callback function registered for that path will be called to generate the content for that URL.

The 'type' of the hook_menu item defines how the path/callback combination is represented in the system. It can be a MENU_CALLBACK, which would mean just the registered path/callback combination, but no corresponding 'real' menu entry. A MENU_NORMAL_ITEM, would be the same, but with a 'standard' menu entry, e.g. in the navigation menu. A MENU_LOCAL_TASK is the same, but the corresponding menu entry usually shows up in the $tabs and not in a menu.

All MENU_LOCAL_TASK that share the same base path will end up as a group of tabs. So if you had paths like:

  • some/path/tab1
  • some/path/tab2
  • some/path/tab3

and all of these where defined as MENU_LOCAL_TASK, you would see one tab for each of them on each page they represent.

So to find the places you need to modify/enhance, you should search your codebase for all hook_menu() implementations that define the paths where those tabs show up. Note that they need not all be defined at the same place, but could come from different hook_menu implementations in different modules. Than you'd need to add menu definitions for the tabs you want to add, mapping the relevant paths to callback functions. The callback functions would return the content of the pages that the user should see when clicking the tabs.

If you are displaying node, usually there is already the Edit link in the $tabs, since its not present that might be something else (some kind of layout module). You need to add Edit/ Track options to edit/track what kind of content? Specific node or what?

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