Adding a custom view

Keep having to look this up so here goes:

if you want to add a link to a custom view in the Accounts module you need to create a file called menu.ext.php in the folder /custom/modules/Accounts/Ext/Menus/  – for some reason every time I run a repair in Admin though this file is deleted, I will update this Post once I find out wtf is going on.

Let’s say you’ve got a custom action in the Accounts Module called “hello” , the following code in your menu.ext.php file will add a link with the Text “Hello” in the Accounts list view.

<?php

if(!defined(‘sugarEntry’) || !sugarEntry) die(‘Not A Valid Entry Point’);

if(ACLController::checkAccess(‘Accounts’, ‘edit’, true)) $module_menu[]=Array(
“index.php?module=Accounts&action=hello”,
“Hello”,”Accounts”);

?>

You also need to create a file called action_view_map.php in the folder /custom/modules/Accounts/  and add the line:

<?php  $action_view_map[‘hello’] = ‘hello’;  ?>

You also would need to create a view file in /custom/modules/Accounts/views/view.hello.php  which extends the ViewList class.

See this article for background http://watchcatblog.blogspot.co.uk/2011/07/sugarcrm-adding-custom-view-using-mvc.html

 

 

Advertisements
Posted in SugarCRM

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

%d bloggers like this: