Sugarcrm支持产品指南糖开发人员糖开发人员指南10.0建筑学延期延期

延期

概述

This extension allows for developers to create custom extensions within the framework. Custom extensions are used alongside the extensions found in ./ModuleInstaller/extensions.php.

特性

可用以下扩展属性。有关更多信息,请参阅 延期财产 documentation.

财产 价值
扩展范围 应用
糖变量 $扩展
扩展目录 ./custom/extension/pplication/ext/extensions/
编译扩展文件 ./custom/pplication/ext/extensions/extensions.ext.php.
清单installdef. $ InstallDefs ['extensions']

参数

  • 部分 :清单文件中的部分名称
  • ext. dir. :包含扩展文件的目录
  • 文件 :编译扩展文件的文件的名称
  • 模块 :确定框架如何解释扩展(可选)
    • <Empty> :将为所有模块启用扩展
      • ext.  : ./custom/Extension/modules/<module>/Ext/<Custom Extension>/
      • ext文件 : ./custom/modules/<module>/Ext/<Extension Name>.ext.php
    • <Specific Module> :将启用指定模块的扩展名
      • ext目录 : ./custom/Extension/modules/<Specific Module>/Ext/<Custom Extension>/
      • ext文件 : ./custom/modules/<Specific Module>/Ext/<Extension Name>.ext.php
    • 应用 :仅启用仅应用程序的扩展名
      • ext目录 : ./custom/Extension/application/Ext/<Custom Extension>/
      • ext文件 : ./custom/application/Ext/<Custom Extension>/<Extension Name>.ext.php

执行

以下部分说明了为糖实例实现自定义的各种方式。

文件系统

When working directly with the filesystem, you can create a file in ./custom/extension/pplication/ext/extensions/ to map a new extension in the system. The following example will create a new extension called "example", which is only enabled for "application":

./custom/extension/pplication/ext/extensions/<file>.php

<?php

$extensions['example'] = array(
    'section' => 'example',
    'extdir' => 'Example',
    'file' => 'example.ext.php',
    'module' => 'application' //optional paramater
);

接下来,导航到admin> Repair > Quick Repair and Rebuild. The system will rebuild the extensions and compile your customization into ./custom/pplication/ext/extensions/extensions.ext.php.. Then you will be able to add your own extension files in  ./custom/Extension/application/Ext/Example/.

模块可加载包装

When building a module loadable package, you can use the $ InstallDefs ['extensions'] index to install the extension file.

installdef属性

名称 类型 描述
细绳 要安装的文件的基本路径

The example below will demonstrate the proper install definition that should be used in the ./manifest.php. 文件 in order to add the Extension file to the system. You should note that when using this approach, Sugar will automatically execute Rebuild Extensions to reflect the new Extension in the system.

./manifest.php.

<?php

$manifest = array(
    ...
);

$installdefs = array(
    'id' => 'customExtension_Example',
    'extensions' => array(
        array(
            'from' => '<basepath>/Files/custom/Extension/application/Ext/Extensions/<file>.php'
        )
    )
);

Alternatively, you may use the $installdefs['copy'] index for the Extension file. When using this approach, you may need to manually run repair actions such as a Quick Repair and Rebuild. For more information on the $installdefs['copy'] index and module-loadable packages, please refer to the 介绍清单 page.

最后修改:2020-03-16 17:00:15