Sugarcrm支持产品指南糖开发人员糖开发人员指南11.0建筑学逻辑钩子API钩子beafor_api_call.

beafor_api_call.

概述

The beafor_api_call. hook executes when the v10+ REST Service is about to call the API implementation.

定义

function before_api_call($event, $arguments){}

争论

名称 类型 描述
事件 细绳 逻辑挂钩事件的名称
争论 大批 与活动有关的其他信息
争论.api. 目的 restservice对象
争论.request. 目的 restresponse对象

考虑

  • This is a global logic hook where the logic hook reference must be placed in ./custom/modules/logic_hooks.php..
  • 此挂钩可以更改被调用的方法和参数。
  • 此挂钩不应用于任何类型的显示输出。

更改日志

版本 笔记
7.0.0RC1. Added beafor_api_call. hook

例子

./custom/modules/logic_hooks.php.

<?php

    $hook_version = 1;
    $hook_array = Array();

    $hook_array['before_api_call'] = Array();
    $hook_array['before_api_call'][] = Array(
        //Processing index. For sorting the array.
        1, 

        //Label. A string value to identify the hook.
        'before_api_call example', 

        //The PHP file where your class is located.
        'custom/modules/logic_hooks_class.php',

        //The class the method is in. 
        'logic_hooks_class',

        //The method to call. 
        'before_api_call_method' 
    );

?>

./custom/modules/logic_hooks_class.php.

<?php

    if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    class logic_hooks_class
    {
        function before_api_call_method($event, $arguments)
        {
            //logic
        }
    }

?>

 

最后修改:2021-02-17 02:44:13