如何在 sugarCRM 中插入带有 href 的文本以记录视图的字段
How to insert text with href to record view's field In sugarCRM
如何在 SugarCRM 中插入带 href 的文本以记录视图的字段
我们想给任何文本或记录link
custom/modules/your_module/metadata/detailviewdefs.php
array (
'name' => 'temp_c',
'label' => 'LBL_TEMP',
'customCode' => '{if $fields.temp_1_c.value}
<a href="{$fields.temp_1_c.value}" target="_blank">
<img src="imgname.png" alt="Img" width="25" height="25" />
</a>
{/if} />',
),
只需创建URL类型字段:代码如下:
$dictionary['module_name']['fields']['website'] = array (
'labelValue' => 'Website',
'required' => false,
'name' => 'website',
'vname' => 'LBL_WEBSITE',
'type' => 'url',
'massupdate' => '0',
'default' => '',
'no_default' => false,
'comments' => '',
'help' => '',
'importable' => 'true',
'duplicate_merge' => 'disabled',
'duplicate_merge_dom_value' => '0',
'audited' => true,
'reportable' => true,
'unified_search' => false,
'merge_filter' => 'disabled',
'len' => '255',
'size' => '20',
'dbType' => 'varchar',
'gen' => '',
'link_target' => '_blank',
);
文件位置应为:custom\Extension\modules\module_name\Ext\Vardefs\sugarfield_website.php
如何在 SugarCRM 中插入带 href 的文本以记录视图的字段
我们想给任何文本或记录link
custom/modules/your_module/metadata/detailviewdefs.php
array (
'name' => 'temp_c',
'label' => 'LBL_TEMP',
'customCode' => '{if $fields.temp_1_c.value}
<a href="{$fields.temp_1_c.value}" target="_blank">
<img src="imgname.png" alt="Img" width="25" height="25" />
</a>
{/if} />',
),
只需创建URL类型字段:代码如下:
$dictionary['module_name']['fields']['website'] = array (
'labelValue' => 'Website',
'required' => false,
'name' => 'website',
'vname' => 'LBL_WEBSITE',
'type' => 'url',
'massupdate' => '0',
'default' => '',
'no_default' => false,
'comments' => '',
'help' => '',
'importable' => 'true',
'duplicate_merge' => 'disabled',
'duplicate_merge_dom_value' => '0',
'audited' => true,
'reportable' => true,
'unified_search' => false,
'merge_filter' => 'disabled',
'len' => '255',
'size' => '20',
'dbType' => 'varchar',
'gen' => '',
'link_target' => '_blank',
);
文件位置应为:custom\Extension\modules\module_name\Ext\Vardefs\sugarfield_website.php