0

I'm developing a drupal 7 based website where the user profiles need some modification. Now I need to know how can I re-order tabs in user profile page such as, View, Edit, etc.

i'd like to keep the current tabs, but just reorder them. I'm looking for an easy way to do that.

1

You can use hook_menu_local_tasks_alter for example in the bellow example i will change the order between tab 2 and tab 3:

/**
 * Implements hook_menu_local_tasks_alter().
 */
function YouModule_menu_local_tasks_alter(&$data, $router_item, $root_path) {
  if (isset($data['tabs'][0]['output'])) {
   $data['tabs'][0]['output'][0]['#weight'] = 0;
   $data['tabs'][0]['output'][1]['#weight'] = 2;
   $data['tabs'][0]['output'][2]['#weight'] = 1;
   $data['tabs'][0]['output'][3]['#weight'] = 3;
   $data['tabs'][0]['output'][4]['#weight'] = 4;
  }
}
| improve this answer | |
  • Hi @berramou, Thanks for your quick answer. I'll surely try the method you shared and post an update here. Thanks again for answering my drupal 7 question. – Abu Zafor Feb 28 '19 at 21:27
  • you are welcome, i have tested it it works, change the weigh as you like will change the order. – berramou Feb 28 '19 at 21:28
  • Thanks again, The code is working great. That's what I was looking for. – Abu Zafor Feb 28 '19 at 21:53
  • i'm glad that help. – berramou Feb 28 '19 at 21:54

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.