加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

sugarcrm – 通过清单文件向editviewdefs.php添加面板

发布时间:2020-12-13 13:53:55 所属栏目:PHP教程 来源:网络整理
导读:在 SugarCRM installable changes in detailview 有人询问如何添加面板,使用Module Installer的清单文件添加到现有模块的editview / detailview,而不会消除以前在自定义目录中进行的自定义. 答案提供了如何添加字段,但不提供面板. 我知道你可以使用从清单文

SugarCRM installable changes in detailview
有人询问如何添加面板,使用Module Installer的清单文件添加到现有模块的editview / detailview,而不会消除以前在自定义目录中进行的自定义.

答案提供了如何添加字段,但不提供面板.

我知道你可以使用从清单文件中调用的post_execute函数来编辑editviewdefs.php和detailviewdefs.php文件.
/自定义/模块//元数据/
目录,但这涉及对这些文件中已存在的内容进行一些猜测.

有没有人知道如何通过清单文件(或post_execute)添加面板,逐步添加面板,而不使用PHP代码手动编辑editviewdefs.php和detailviewdefs.php文件?

您正在使用ParserFactory类,该类可以在安装模块/包时执行的post_install或类似脚本中使用.我的理解是ParserFactory会调用自定义文件,如果它们存在,或者库存文件,如果没有,则适当安全地调整它们.

在模块的目录中,创建一个名为’scripts’的子目录,并创建包含单个函数post_install()的’post_install.php’.你的包dir看起来像这样:

~$find .
/LICENSE.txt
/manifest.php
/scripts/post_install.php

你像这样使用ParserFactory:

<?php
function post_install(){

// $parser becomes an associative array for the metadata,similar to editviewdefs.php
require_once('modules/ModuleBuilder/parsers/ParserFactory.php');
$parser = ParserFactory::getParser('detailview','Accounts');

// finding the panels (which contain their fields),you can 
// now add fields or additional arrays to this array,creating new panels
// (you could manipulate $parser->_viewdefs directly,but I find this easier)
$panels = array_keys ( $parser->_viewdefs [ 'panels' ] );

// place your panels back into the $parser and save
$parser->_viewdefs['panels'] = $panels;
$parser->handleSave(false);

};

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读