Table of Contents Previous Next

Sugar Developer Guide

Version 5.1


Chapter 4 Customizing Sugar : The Custom Directory : Layoutdefs

Layoutdefs
Master Directories
Files in these directories can be edited and new files can be added to these directories.
Production Directories
Files in these directories are auto-generated by the system.
Description
Layoutdefs are a little more complex than the other customization types. Each customization is made across two files, the layout definition file and the actual layout file. In the Master Directories you can have many files like:
During the repair function (Admin->Repair->Quick Repair and Rebuild), all of these files will be merged together into the production directory and they become the file:
/custom/modules/Accounts/Ext/Layoutdefs/layoutdefs.ext.php
For example, a layoutdefs extension file for the Accounts module could contain the following:
/custom/Extension/modules/Accounts/ext/Layoutdefs/_overrideAccountContactsForAccounts.php
<?php
$layout_defs["Accounts"]["subpanel_setup"]["accounts_documents"] = array (
'order' => 100,
'module' => 'Documents',
'subpanel_name' => 'default',
'sort_order' => 'asc',
'sort_by' => 'id',
'title_key' => 'LBL_ACCOUNTS_DOCUMENTS_FROM_DOCUMENTS_TITLE',
'get_subpanel_data' => 'accounts_documents',
);
 
$layout_defs['Accounts']['subpanel_setup']['contacts']['override_subpanel_name'] = 'AccountForAccounts';
?>
 
The first array is setting up a subpanel for a new relationship between Documents and Accounts. While there are many other files required to completely define this module relationship (which we will go over in the Relationship section below), this file just creates the links to the new subpanel that would be located at:
custom/modules/Documents/Ext/subpanels/default.php
The second array simply points the system at a new subpanel definition file that will replace the subpanel that shows Contacts related to Accounts. Since you cannot merge subpanel definition files, they don't exist in the custom/Extension/ directory. The array in this file would tell the system to load the file:
custom/modules/Contacts/metadata/subpanels/AccountForAccounts.php

Table of Contents Previous Next

Copyright 2004-2008 SugarCRM Inc.
Product License