Table of Contents Previous Next

Sugar Developer Guide

Version 5.1


Chapter 4 Customizing Sugar : Business Logic Hooks : Hook Definition

Hook Definition
The code that declares your custom logic is located in: custom/modules/<CURRENT_MODULE>/logic_hooks.php. The format of the declaration follows.
$hook_version
All logic hooks should define the $hook_version that should be used. Currently, the only supported $hook_version is 1.
$hook_version = 1
$hook_array
Your logic hook will also define the $hook_array. $hook_array is a two dimensional array:
o
name: the name of the event that you are hooking your custom logic to
o
array: an array containing the parameters needed to fire the hook
A best practice is for each entry in the top level array to be defined on a single line to make it easier to automatically replace this file. Also, logic_hooks.php should contain only hook definitions; the actual logic is defined elsewhere.
For example:
$hook_array['before_save'][] = Array(1, test, 'custom/modules/Leads/test12.php', 'TestClass', 'lead_before_save_1');

Table of Contents Previous Next

Copyright 2004-2008 SugarCRM Inc.
Product License