0

With Tab Tamer we can change the weight/order of tabs in the user account under user/% (e.g. put user/%/edit after user/%/some_settings), but we can't set depth between the tabs (e.g. user/%/some_settings under user/%/edit/some_settings).

With User Tabs we can create some depth at least for user/%/edit (makes it as a subtab of Account), but it doesn't offer options to put other tabs as subtabs of Account.

So how to transform tabs to subtabs in the user account?

0

I forked User Tabs and added new subtabs (see NEW-SUBTAB in code):

/**
 * 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';
      }
    }
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.