'primary_address_street', * 'type' => 'address', * 'displayParams'=>array('key'=>'primary'), * ), * * Where name is set to the field for ACL verification, type is set to 'address' * to override the default field type and the displayParams array includes the key * for the address field. Assumptions are made that the vardefs.php contains address * elements with the corresponding names. There is the optional displayParam index * 'copy' that accepts as value the key of the other address fields. In our * example we may enable copying from the primary address fields with: * * array ( * 'name' => 'altaddress_street', * 'type' => 'address', * 'displayParams'=>array('key'=>'alt', 'copy'=>'primary'), * ), * */ require_once('include/SugarFields/Fields/Base/SugarFieldBase.php'); class SugarFieldAddress extends SugarFieldBase { function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); global $app_strings; if(!isset($displayParams['key'])) { $GLOBALS['log']->debug($app_strings['ERR_ADDRESS_KEY_NOT_SPECIFIED']); $this->ss->trigger_error($app_strings['ERR_ADDRESS_KEY_NOT_SPECIFIED']); return; } //Allow for overrides. You can specify a Smarty template file location in the language file. if(isset($app_strings['SMARTY_ADDRESS_DETAILVIEW'])) { $tplCode = $app_strings['SMARTY_ADDRESS_DETAILVIEW']; return $this->fetch($tplCode); } global $current_language; if(isset($current_language) && file_exists('include/SugarFields/Fields/Address/' . $current_language . '.DetailView.tpl')) { return $this->fetch('include/SugarFields/Fields/Address/' . $current_language . '.DetailView.tpl'); } else { return $this->fetch('include/SugarFields/Fields/Address/DetailView.tpl'); } //if-else } function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); global $app_strings; if(!isset($displayParams['key'])) { $GLOBALS['log']->debug($app_strings['ERR_ADDRESS_KEY_NOT_SPECIFIED']); $this->ss->trigger_error($app_strings['ERR_ADDRESS_KEY_NOT_SPECIFIED']); return; } //Allow for overrides. You can specify a Smarty template file location in the language file. if(isset($app_strings['SMARTY_ADDRESS_EDITVIEW'])) { $tplCode = $app_strings['SMARTY_ADDRESS_EDITVIEW']; return $this->fetch($tplCode); } global $current_language; if(isset($current_language) && file_exists('include/SugarFields/Fields/Address/' . $current_language . '.EditView.tpl')) { return $this->fetch('include/SugarFields/Fields/Address/' . $current_language . '.EditView.tpl'); } else { return $this->fetch('include/SugarFields/Fields/Address/EditView.tpl'); } //if-else } } ?>