发布于 2018-06-18 11:50:04
我分叉了用户选项卡并添加了新的子选项卡(请参阅代码中的):
/**
* Implements hook_menu_alter().
*/
function usertabs_menu_alter(&$callbacks) {
$callbacks['user/%user/account'] = array(
'title' => 'Account',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
'load arguments' => array('%map', '%index'),
);
//move the original edit and view items to below this container
_usertabs_move_item($callbacks, 'user/%user/view', 'user/%user/account/view', MENU_DEFAULT_LOCAL_TASK);
_usertabs_move_item($callbacks, 'user/%user/edit', 'user/%user/account/edit', MENU_LOCAL_TASK);
_usertabs_move_item($callbacks, 'user/%user/NEW-SUBTAB', 'user/%user/account/NEW-SUBTAB', MENU_LOCAL_TASK);
unset($callbacks['user/%user_category/edit/account']);
if (($categories = _user_categories()) && (count($categories) > 1)) {
foreach ($categories as $key => $category) {
// 'account' is already handled by the MENU_DEFAULT_LOCAL_TASK.
if ($category['name'] != 'account') {
//it was too friggin complicated to support %user_category
//see comments in user_category_load
//all it does is check that the category name is valid
_usertabs_move_item($callbacks, 'user/%user_category/edit/' . $category['name'], 'user/%user/account/'.$category['name']);
$callbacks['user/%user/account/'.$category['name']]['tab_parent'] = 'user/%/account';
}
}
}
}https://drupal.stackexchange.com/questions/263060
复制相似问题