Skip to content

Instantly share code, notes, and snippets.

@sugarknowledge
Created July 6, 2012 21:22
Show Gist options
  • Select an option

  • Save sugarknowledge/3062816 to your computer and use it in GitHub Desktop.

Select an option

Save sugarknowledge/3062816 to your computer and use it in GitHub Desktop.
Example Manifest for installing a logic hook
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class Accounts_Save
{
function updateAccountName(&$bean, $event, $arguments)
{
$bean->name = "My New Account Name (" . time() . ")";
}
}
?>
<?php
$manifest =array(
'acceptable_sugar_flavors' => array('CE','PRO','CORP','ENT','ULT'),
'acceptable_sugar_versions' => array(
'exact_matches' => array(),
'regex_matches' => array('6\\.[0-9]\\.[0-9]$'),
),
'author' => 'SugarCRM',
'description' => 'Installs a sample logic hook',
'icon' => '',
'is_uninstallable' => true,
'name' => 'Example Logic Hook Installer',
'published_date' => '2012-07-06 2012 20:45:04',
'type' => 'module',
'version' => '1341607504',
);
$installdefs =array(
'id' => 'package_1341607504',
'copy' => array(
0 => array(
'from' => '<basepath>/Files/custom/modules/Accounts/accounts_save.php',
'to' => 'custom/modules/Accounts/accounts_save.php',
),
),
'logic_hooks' => array(
array(
'module' => 'Accounts',
'hook' => 'before_save',
'order' => 99,
'description' => 'Example Logic Hook - Updates account name',
'file' => 'custom/modules/Accounts/accounts_save.php',
'class' => 'Accounts_Save',
'function' => 'updateAccountName',
),
),
);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment