简体   繁体   English

Drupal 7-将选项卡链接添加到节点编辑表单

[英]Drupal 7 - Add tab link to Node Edit Form

Developing a module for Drupal 7 I can't seem to find how to add a link to neither the horizontal or the vertical tab when editing a node. 为Drupal 7开发模块在编辑节点时,我似乎找不到如何向水平或垂直选项卡添加链接的方法。 I'm pretty sure I have to use hook_menu_alter but still... 我很确定我必须使用hook_menu_alter,但是仍然...

menu 1 菜单1

menu 2 菜单2

You don't need to use hook_menu_alter , you can just use hook_menu to define the new path: 您不需要使用hook_menu_alter ,只需使用hook_menu即可定义新路径:

/**
 * Implements hook_menu().
 */
function mymodule_global_menu() {
  $items['node/%/some_action'] = array(
    'title' => 'This Is A new Tab',
    'page callback' => 'mymodule_some_action_tab',
    'access arguments' => array('access content'),
    'type' => MENU_LOCAL_TASK,
  );
  return $items;
}

Replace some_action with the actual sub path you want to use, and mymodule_some_action_tab with the actual callback function for the tab. some_action替换为您要使用的实际子路径,并将mymodule_some_action_tab替换为该选项卡的实际回调函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM