首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何更改用户帐户选项卡的顺序和深度

如何更改用户帐户选项卡的顺序和深度
EN

Drupal用户
提问于 2018-06-11 20:10:08
回答 1查看 26关注 0票数 0

使用塔米尔,我们可以在user/%下更改用户帐户中选项卡的权重/顺序(例如,在user /%/settings之后放置user/%/edit ),但不能在选项卡之间设置深度(例如,user/%/some_settings下的user/%/edit/some_ set )。

使用用户表,我们可以为用户/%/编辑(使其成为帐户的子选项卡)创建一定的深度,但它不提供将其他选项卡作为帐户子选项卡的选项。

那么,如何将选项卡转换为用户帐户中的子选项卡?

EN

回答 1

Drupal用户

回答已采纳

发布于 2018-06-18 11:50:04

我分叉了用户选项卡并添加了新的子选项卡(请参阅代码中的):

代码语言:javascript
复制
/**
 * 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';
      }
    }
  }
}
票数 0
EN
页面原文内容由Drupal提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://drupal.stackexchange.com/questions/263060

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档