0

I am making a custom module and the link to the path appears on navigation menu by default but I am interested it appears on primary menu when module is enabled. Is it possible in Drupal 7?

1

Set the menu_name key of your menu-router item. From the docs:

menu_name: Optional. Set this to a custom menu if you don't want your item to be placed in Navigation.

By default the primary links are set to the Main menu (machine name: main-menu). Therefore use something like this in your implementation of hook_menu:

function hook_menu() {
  $items['example'] = array(
    'title' => 'Example Page',
    'page callback' => 'example_page',
    'access arguments' => array('access content'),
    'type' => MENU_NORMAL_ITEM,
    'menu_name' => 'main-menu',
  );
  return $items;
}
0

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.