我认为您无法像在 EditView 和 DetailView 中那样获得在 ListView 中寻找的相同结果。解决此问题的一种方法是向 Leads vardef 添加一个非数据库字段,并使用逻辑挂钩来处理条件格式。
创建一个新的 vardef:
/自定义/扩展/模块/案例/Ext/Vardefs/my_listview_value_c.php
<?php
$dictionary['Lead']['fields']['my_listview_value_c'] = array(
'name' => 'my_listview_value_c',
'vname' => 'LBL_MY_LISTVIEW_VALUE_C',
'type' => 'varchar',
'len' => '255',
'source' => 'non-db',
);
?>
创建逻辑钩子:
/custom/modules/Leads/ListViewLogicHook.php
<?php
class ListViewLogicHook {
public function getListValue(&$bean, $event, $arguments) {
if ($bean->ld_assumed_sugar_account_id_c) {
$bean->my_listview_value_c = $bean->account_name;
} else {
// Whatever you'd like
}
}
}
添加逻辑钩子条目:
// position, file, function
$hook_array['process_record'] = Array();
$hook_array['process_record'][] = Array(1, 'Conditional formatting in a listview column', 'custom/modules/Leads/ListViewLogicHook.php','ListViewLogicHook','getListValue');
最后,在 listviewdefs 中添加新列:
'MY_LISTVIEW_VALUE_C' =>
array (
'width' => '10%',
'label' => 'LBL_MY_LISTVIEW_VALUE_C',
'default' => true,
),
希望有帮助。