Sugarcrm支持产品指南糖开发人员糖开发人员指南11.0建筑学逻辑钩子模块钩子追逐_Restore.

追逐_Restore.

概述

The 追逐_Restore. hook executes after a record gets undeleted (i.e. the deleted field's value changes from 1 to 0).

定义

function after_restore($bean, $event, $arguments){}

争论

名称 类型 描述
豆角,扁豆 目的 豆角,扁豆对象
事件 细绳 当前的事件
争论 大批 与活动有关的其他信息(通常是空的)

例子

使用扩展框架创建逻辑钩

./custom/extension/modules/<module>/Ext/LogicHooks/<file>.php

<?php

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

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

        //The PHP file where your class is located.
        'custom/modules/<module>/after_restore_class.php.',

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

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

?>

./custom/modules/<module>/after_restore_class.php.

<?php

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

    class after_restore_class
    {
        function after_restore_method($bean, $event, $arguments)
        {
            //logic
        }
    }

?>

创建核心逻辑挂钩

在糖6.3.x之前,只能使用以下方法创建逻辑钩。请注意,此方法仍然有效,但在构建插件时不建议使用与现有自定义相冲突时。

./custom/modules/<module>/logic_hooks.php

<?php

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

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

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

      //The PHP file where your class is located.
      'custom/modules/<module>/after_restore_class.php.', 

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

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

?>

./custom/modules/<module>/after_restore_class.php.

<?php

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

   class after_restore_class
   {
      function after_restore_method($bean, $event, $arguments)
      {
         //logic
      }
   }

?>

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