Drupal 7:在配置页面中创建选项卡
我已经创建了一个带有配置页面的模块,一切正常,但我的配置页面似乎没完没了。因此,您希望在评论的配置页面中创建选项卡: 我搜索了很多,并试图分析评论模块代码,但没有成功: 有人能帮我吗,或者至少给我一个线索 提前感谢,,Drupal 7:在配置页面中创建选项卡,drupal,tabs,drupal-7,Drupal,Tabs,Drupal 7,我已经创建了一个带有配置页面的模块,一切正常,但我的配置页面似乎没完没了。因此,您希望在评论的配置页面中创建选项卡: 我搜索了很多,并试图分析评论模块代码,但没有成功: 有人能帮我吗,或者至少给我一个线索 提前感谢,, BDR您需要为您的模块实现钩子菜单。我可以从drupal.org向您推荐很棒的drupal,它在扩展drupal的大多数方面都有很好的例子。此代码取自示例模块的菜单\u示例子模块: function mymodule_menu(){ // A menu entry with
BDR您需要为您的模块实现钩子菜单。我可以从drupal.org向您推荐很棒的drupal,它在扩展drupal的大多数方面都有很好的例子。此代码取自示例模块的菜单\u示例子模块:
function mymodule_menu(){
// A menu entry with tabs.
// For tabs we need at least 3 things:
// 1. A parent MENU_NORMAL_ITEM menu item (examples/menu_example/tabs in this
// example.)
// 2. A primary tab (the one that is active when we land on the base menu).
// This tab is of type MENU_DEFAULT_LOCAL_TASK.
// 3. Some other menu entries for the other tabs, of type MENU_LOCAL_TASK.
$items['examples/menu_example/tabs'] = array(
// 'type' => MENU_NORMAL_ITEM, // Not necessary since this is the default.
'title' => 'Tabs',
'description' => 'Shows how to create primary and secondary tabs',
'page callback' => '_menu_example_menu_page',
'page arguments' => array(t('This is the "tabs" menu entry.')),
'access callback' => TRUE,
'weight' => 30,
);
// For the default local task, we need very little configuration, as the
// callback and other conditions are handled by the parent callback.
$items['examples/menu_example/tabs/default'] = array(
'type' => MENU_DEFAULT_LOCAL_TASK,
'title' => 'Default primary tab',
'weight' => 1,
);
$items["examples/menu_example/tabs/second"] = array(
'type' => MENU_LOCAL_TASK,
'title' => 'Second tab',
'page callback' => '_menu_example_second_page',
'access callback' => TRUE,
'weight' => 2,
);
return $items;
}
您需要为您的模块实现hook_菜单。我可以从drupal.org向您推荐很棒的drupal,它在扩展drupal的大多数方面都有很好的例子。此代码取自示例模块的菜单\u示例子模块:
function mymodule_menu(){
// A menu entry with tabs.
// For tabs we need at least 3 things:
// 1. A parent MENU_NORMAL_ITEM menu item (examples/menu_example/tabs in this
// example.)
// 2. A primary tab (the one that is active when we land on the base menu).
// This tab is of type MENU_DEFAULT_LOCAL_TASK.
// 3. Some other menu entries for the other tabs, of type MENU_LOCAL_TASK.
$items['examples/menu_example/tabs'] = array(
// 'type' => MENU_NORMAL_ITEM, // Not necessary since this is the default.
'title' => 'Tabs',
'description' => 'Shows how to create primary and secondary tabs',
'page callback' => '_menu_example_menu_page',
'page arguments' => array(t('This is the "tabs" menu entry.')),
'access callback' => TRUE,
'weight' => 30,
);
// For the default local task, we need very little configuration, as the
// callback and other conditions are handled by the parent callback.
$items['examples/menu_example/tabs/default'] = array(
'type' => MENU_DEFAULT_LOCAL_TASK,
'title' => 'Default primary tab',
'weight' => 1,
);
$items["examples/menu_example/tabs/second"] = array(
'type' => MENU_LOCAL_TASK,
'title' => 'Second tab',
'page callback' => '_menu_example_second_page',
'access callback' => TRUE,
'weight' => 2,
);
return $items;
}