Sugarcrm支持产品指南糖开发人员糖开发人员指南10.0建筑学延期ActionFileMap.
此页面指的是仅在以后兼容模式下运行的模块中可用的内容。

ActionFileMap.

概述

The ActionFileMap. extension maps actions to files, which helps you map a file to a view outside of 。/风俗/modules/<module>/views/view.<name>.php. This page is only applicable to modules running in backward compatibility mode.

特性

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

财产 价值
扩展范围 模块
糖变量 $ action_file_map.
扩展目录 。/风俗/extension/modules/<module>/Ext/ActionFileMap/
编译扩展文件 。/风俗/<module>/ext/actionfilemap/action_file_map.ext.php.
清单installdef. $ InstallDefs ['action_file_map']

执行

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

文件系统

When working directly with the filesystem, you can create a file in 。/风俗/extension/modules/<module>/Ext/ActionFileMap/ to map a new action in the system. The following example will create a new action called "example" in a module:

。/风俗/extension/modules/<module>/Ext/ActionFileMap/<file>.php

<?php

$action_file_map['new_action'] = 'custom/modules/<module>/new_action.php';

接下来,创建您的操作文件:

。/风俗/modules/<module>/new_action.php

<?php

//Encoded as JSON for AJAX layouts
echo '{"content":"Example View"}';

?>

接下来,导航到admin> Repair >快速修复和重建。然后系统将重建扩展并编译您的自定义 。/风俗/modules/<module>/ext/actionfilemap/action_file_map.ext.php.

模块可加载包装

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

installdef属性

名称 类型 描述
细绳 要安装的文件的基础路径。 
to_module. 细绳 将安装文件的模块的键。

The example below demonstrates the proper install definition that should be used in the ./manifest.php. 文件 in order to add the Action File Map file to a specific module. You should note that when using this approach, you still need to use the $installdefs['copy'] index for the Action file, but Sugar will automatically execute Rebuild Extensions to reflect the new Action in the system.

./manifest.php.

<?php

$manifest = array(
    ...
);

$installdefs = array(
    'id' => 'ActionRemap_Example',
    'action_file_map' => array(
        array(
            'from' => '<basepath>/Files/custom/Extension/modules/<module>/Ext/ActionFileMap/<file>.php',
            'to_module' => '<module>',
        )
    ),
    'copy' => array(
        array(
            'from' => '<basepath>/Files/custom/example.php',
            'to' => 'custom/example.php'
        )
    )
);

Alternatively, you may use the $installdefs['copy'] index for the Action File Map 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