Adding items to the Shortcuts menu

bsoremsugar —  August 27, 2008 — 1 Comment

Want to add items to the shortcut menu?  No problem.  Create the following file

custom/modules/<module name>/Ext/Menus/menu.ext.php

Here is an example of the contents:

<?php
$module_menu[] =Array(“index.php?module=Reports&action=index&view=contacts”, $mod_strings['LNK_CONTACT_REPORTS'],”ContactReports”, ‘Contacts’);
$module_menu[] =Array(“javascript:SUGAR.subpanelUtils.loadSubpanelGroup(‘Activities’);”, $mod_strings['LBL_ACTIVITIES'],”Contacts”);

?>

The $module_menu array contains 4 elements:

  • The first element is target of the click.  It can either be a URL or Javascript
  • The second element is the text to display in the menu.  This must obviously be defined in a language file
  • The third element is the icon to display next to the shortcut.  The icons can be found in the themesdefaultimages directory.
  • The fourth element (which is optional) is the name of the module.

In the examples above, the first line takes you to Contact Reports.  The second example changes the tab in the detail view to make the Activities subpanel have focus

Trackbacks and Pingbacks:

  1. Sugar Developer Blog » Blog Archive » HOWTO: Have items in the shortcuts menu create popup windows - May 4, 2011

    [...] while back Sugar Engineer Lam Huynh did some great writeups on adding and modifying the shortcuts menu for a module, which show how easy it is to make these changes in [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s