Table of Contents Previous Next

Sugar Developer Guide

Version 5.1


Chapter 4 Customizing Sugar : The Custom Directory : Vardefs

Vardefs
Vardefs define field attributes for a given module. Existing vardefs can be modified and new vardefs can be created by modifying Vardefs files in the custom directory.
Master Directories
Files in these directories can be edited and new files can be added to these directories.
/custom/Extension/modules/<MODULE_NAME>/Ext/Vardefs/
Production Directories
Files in these directories are auto-generated by the system.
/custom/modules/<MODULE_NAME>/Ext/Vardefs/vardefs.ext.php
Description
Vardefs files either replace entirely or add to the field definitions that are available to a module. 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/Calls/Ext/Vardefs/vardefs.ext.php
For example, a vardefs extension file for the Calls module could contain the following:
/custom/Extension/modules/Calls/ext/Vardefs/Import_Vardefs.php
<?php
$dictionary['Call']['fields']['parent_type']['vname'] = 'LBL_PARENT_TYPE';
$dictionary['Call']['fields']['parent_id']['vname'] = 'LBL_PARENT_ID';}
$dictionary['Call']['fields']['deleted']['importable'] = false;
 
$dictionary['Call'] = array('fields' => array (
'related_id' => array (
'name' => 'related_id',
'vname' => 'LBL_RELATED_ID',
'type' => 'id',
'required' => false,
'reportable' => false,
'audited' => true,
'comment' => 'ID of a related record of this call',
);
?>
This would change the values for the “vname” of parent_type and parent_id, it would add an “importable” value to the deleted field and set it to false and then add a whole new field called related_id to the calls field list.

Table of Contents Previous Next

Copyright 2004-2008 SugarCRM Inc.
Product License