I am trying to add a custom menu to Drupal 7 but it seems that I am not able to handle external links in hook_menu as they don't get inserted into the database. When I change the implementation to use menu_link_save, internal menu items don't get saved in the menu route table so they don't show up. Is there a way to implement a custom menu that will be displayed in the footer that contains both normal menu items and links to external websites?
2 Answers
6
votes
hook_menu() is really only for internal paths by design and as such external paths don't belong in the menu_router table. There is a little trick you can do to make internal paths that you define immediately redirect to the external site, using drupal_goto() as your page callback:
$items['my_internal_path'] = array(
'title' => 'Title',
'type' => MENU_NORMAL_ITEM,
'access arguments' => array('access content'),
'page callback' => 'drupal_goto',
'page arguments' => array('http://external-site.com/')
);
Hope that helps