修改SUGARCRM中view .detail.php(详细视图)中的字段值


Alter Field Value in View.detail.php ( detail view ) in SUGARCRM

我在联系人模块中使用下面的类添加了一个自定义字段。基本上,我有一个文本字段字段"项目详细信息"在联系模块。如果用户在编辑视图的项目详细信息字段中输入一些数据,则将显示在详细视图中。我想在详细视图中更改"项目详细信息"字段的值。我想将str_replace()函数应用于"project_details"字段,仅在该特定的详细视图中(而不是在其他视图中)。所以我想我可以使用下面的类来做到这一点。如果有其他选择,我也愿意接受。

文件路径:custom/modules/Contacts/views/view.detail.php

  class CustomContactsViewDetail extends ContactsViewDetail {
    public function display()
    {
        $someVariable = 'something that generates out field output will go here';
        // Assign custom "Status" value to Smarty template
        $this->ss->assign('STATUS', $somaeVariable);
        parent::display();
    }
}

我想,我必须添加一些代码像这个改变或替换字段值中的一些字符串。就像下面的示例代码一样。但我知道这行不通。

 <?php
       require_once('modules/Contacts/views/view.detail.php');
      class CustomContactsViewDetail extends ContactsViewDetail {
        public function display()
        {
        $this->field['project_details']['value'] = str_replace("###EMAIL###", "admin@mywebsite.com", $this->field['project_details']['value']);
            parent::display();
        }
    }

任何帮助都将非常感激。

Try

$this->ev->fieldDefs['project_details']