Created
November 28, 2012 22:01
-
-
Save chadhutchins/4164976 to your computer and use it in GitHub Desktop.
Installing Global Logic Hooks in SugarCRM using the Module Loader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Accounts_logic_hook_class | |
{ | |
function Accounts_logic_hook_method(&$bean, $event, $arguments) | |
{ | |
echo "Hit the Accounts before save logic hook"; | |
exit; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Global_logic_hook_class | |
{ | |
function Global_logic_hook_method(&$bean, $event, $arguments) | |
{ | |
echo "Hit the global before save logic hook"; | |
exit; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$installdefs = array( | |
'id' => 'Global_Logic_Hook_Testing', | |
'copy' => array( | |
// move file that contains the class and | |
// method for the logic hooks below | |
array( | |
'from' => '<basepath>/accounts_logic_hook.php', | |
'to' => 'custom/modules/Accounts/accounts_logic_hook.php', | |
), | |
array( | |
'from' => '<basepath>/global_logic_hook.php', | |
'to' => 'custom/modules/global_logic_hook.php', | |
), | |
), | |
'logic_hooks' => array( | |
// regular logic hook for Accounts module | |
array( | |
'module' => 'Accounts', | |
'hook' => 'before_save', | |
'order' => 50, | |
'description' => 'Do work on the Accounts module SON!', | |
'file' => 'custom/modules/Accounts/accounts_logic_hook.php', | |
'class' => 'Accounts_logic_hook_class', | |
'function' => 'Accounts_logic_hook_method', | |
), | |
// global logic hook | |
array( | |
'module' => '', | |
'hook' => 'before_save', | |
'order' => 60, | |
'description' => 'Do global work SON!', | |
'file' => 'custom/modules/Contacts/test.php', | |
'class' => 'Global_logic_hook_class', | |
'function' => 'Global_logic_hook_method', | |
), | |
), | |
); | |
$manifest = array( | |
'acceptable_sugar_versions' => array('regex_matches' => array(0 => '6\.*'),), | |
'acceptable_sugar_flavors' => array(0 => 'CE',1 => 'PRO',2 => 'ENT',), | |
'name' => 'Global Logic Hook', | |
'description' => 'Showing how to install a global logic hook', | |
'is_uninstallable' => true, | |
'author' => 'Chad Hutchins, SugarOutfitters', | |
'published_date' => 'November 28, 2012', | |
'version' => '1.0.3', | |
'type' => 'module', | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment