SugarCRM How To Add Shortcuts To Menu

Do you like this?

Summary:
This post shows you how to add shortcuts into the menu bar of SugarCRM for different modules.


Content:

Suppose we want to add the shortcut of a custom action named Hello into the Accounts module.

This is the end result:
SugarCRM Custom Shortcut Menu 1

In the custom folder, create the file menu.ext.php
SugarCRM Custom Shortcut Menu 2

In the file, add the following code:

<?php 

$module_menu[]=Array(
	"index.php?module=Accounts&action=hello" ,
	"Hello","Accounts");


?>
To create the custom action Hello, create the file controller.php as follows:
SugarCRM Custom Shortcut Menu 3

Add the following code:
<?php
require_once('include/MVC/Controller/SugarController.php');

class AccountsController extends SugarController {
    
	function action_hello(){
		$this->view = 'helloActionView';
	}
}
?>
Now you need to create a view for this action:
SugarCRM Custom Shortcut Menu 4

<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

require_once('include/MVC/View/views/view.detail.php');

class ViewHelloActionView extends ViewDetail {


	function ViewHelloActionView(){
		parent::ViewDetail();
	}
	
	function display() {
		echo "hello";
	}

}

?>
The final step is to go to the Admin section and then click on Repair\Quick Repair and Rebuild.

 
comments powered by Disqus