Monday, June 30, 2014

Open a menu link in new window

In Drupal clicking on the menu links will open in the same window. if we want to open the menu links in new window or new tabs, use 'hook_menu_link_alter',

eg:
  1. function mymodule_menu_link_alter(&$item) {
  2.     if ($item['link_path'] == 'node/10') {
  3.       $item['options']['attributes']['target'] = '_blank';
  4.     }
  5. }

No comments:

Post a Comment