SugarCRM – Menu Items Open in a New Tab/Window
Posted By: Alex.Cottner on February 15th, 2011 in General, Programming, SugarCRM
No Gravatar

The following is a simple example of making a menu item in SugarCRM (an item from a menu.php file) open in a new window. I needed a simple solution for this in order to integrate JasperReports Server.

$module_menu[]=Array("#\" onClick=\"window.open('your_url_here');", $mod_strings['LNK_NAME'],"Image_Name", 'Module_Name');

For those of you not familiar with this array I will break it down. The first item in the array is a URL. Usually this is dumped directly into the href portion of an <a> tag. However we’ve broken this by using #\”. This will force the href value to be “#” and allows us to setup our onClick event to open the link in a new window.

The LNK_NAME is a reference to a label stored in the language file of the current module.

Image_Name is referencing a theme image.

Module_Name is just the name of the module we’re currently in.


Leave a Reply