1

It would be very useful to be able to change the "tabs menu" in "menu links" to specific pages and users roles. In order to customize the UI.

I have not found any module for this.

1 Answer 1

1

One of the ways is to simply change the menu type from MENU_LOCAL_TASK to MENU CALLBACK, and then simply create a menu item with the path.

Sample Code: Cherry pick menu tabs and convert:

function MYMODULE_NAME_menu_alter(&$items) {
  $items['node/%node/view']['type'] = MENU_CALLBACK;
  $items['node/%node/edit']['type'] = MENU_CALLBACK;
}

Convert all at once

function MYMODULE_NAME_menu_alter(&$items) {
  foreach ($items as $key => $value) {
    if ($items[$key]['type'] == MENU_LOCAL_TASK) {
      $items[$key]['type'] = MENU_CALLBACK;
    }
  }
}
2
  • But in this way I must reconstruct every path. If I wanted to automatically do it?
    – Daniele
    Commented Sep 29, 2016 at 13:54
  • @Daniele I have updated the answer check now if that works for you.
    – arpitr
    Commented Sep 29, 2016 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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