问题描述
我有一个简单的问题,但对我来说可能很严重,我制作了自定义字段并将它们全部添加到 Leads 模块的 custom\modules\Leads\metadata\detailviewdefs.php
(detailview 布局)中但问题是我必须制作一个安装程序包的更改.我使用自定义字段进行管理,并通过清单将它们复制到 custom\Extension\modules\Leads\Ext\Vardefs
中.现在我不知道如何通过清单应用 detailviewdefs 更改(在 detailview 中添加新字段面板).重点是现有的 detailview 布局不应更改,而应仅在其中添加一个新面板.
I have a simple problem but may be serious for me , I made custom fields and added them all in the custom\modules\Leads\metadata\detailviewdefs.php
(detailview layout) of Leads module but problem is that i have to make a installer package of changes. I managed with custom fields and copied them in the custom\Extension\modules\Leads\Ext\Vardefs
through manifest. Now i don't know how to apply detailviewdefs changes through manifest (add new fields panel in detailview). The point is that the existing detailview layout should not be changed but only add a new panel in it.
我认为可能的解决方案就像我应该在 $layout_defs 数组中添加代码 $layout_defs["Leads"]["DetailView"] ['panels']['panel_name']
并放置它在 custom\Extension\modules\Leads\Ext\Layoutdefs\
中,并通过清单复制 Layoutdefs 文件.我试过这个,但似乎不起作用.如果可以,寻找智能解决方案共享.
Possible solution in my mind is like I should add code in $layout_defs array $layout_defs["Leads"]["DetailView"] ['panels']['panel_name']
and place it in custom\Extension\modules\Leads\Ext\Layoutdefs\
and copy Layoutdefs file through manifest. I tried this but not seems working one.Looking for a smart solution share if you can.
添加:即使我从 Studio ->export Customizations
导出模块更改并使用 module builder
在其他实例中导入.它覆盖了较新实例中所有以前的自定义文件(自定义)(这不是 SugarCRM 中的限制),但我的要求是仅在较新实例的详细信息视图中添加更改.
Addition:Even if i export module changes from Studio ->export Customizations
and import in other instance with module builder
. It override all the previous custom files(customizations) in newer instance (Is it not a limitation in SugarCRM) but my requirement is to add only changes in newer instance's detailview.
推荐答案
我发现了 Sugar 的 ModuleInstaller
类的以下功能,可以通过 manifest script
从布局中添加或删除字段.这些函数将同时向 editview
和 detail view
添加/删除字段.只需在 post_install/pre_install
中添加以下几行,不需要任何东西,
I had found following functions of sugar's ModuleInstaller
class to add or remove fields from layouts through manifest script
. These functions will add/remove fields to both editview
and detail view
at the same time. Just add following lines in post_install / pre_install
no need to require anything,
$installer_func = new ModuleInstaller();
$layoutAdditions = array('Users' => 'users_access');
要在 Users
模块中添加 users_access
字段:
To add users_access
field in Users
module:
$installer_func->addFieldsToLayout($layoutAdditions);
从 Users
模块中删除 users_access
字段:
To remove users_access
field from Users
module:
$installer_func->removeFieldsFromLayout($layoutAdditions);
希望对您有所帮助.
曼苏尔
这篇关于SugarCRM 可安装更改详情视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!