function mymodule_civicrm_buildForm($formName, &$form) { if ($formName == 'CRM_Event_Form_ManageEvent_Registrants') { // Add a custom field to the registrants form $form->add('text', 'custom_field', 'Custom Field'); } }
function mycomponent_civicrm_postHook($hookName, $objectName, $objectId, &$params) { if ($hookName == 'create') { // Send an email notification when a new contact is created mail('admin@example.com', 'New Contact Created', 'A new contact was created.'); } }
function myreport_civicrm_alterReportVar(&$var, &$outputProperties, $field, $label, $value) { if ($var == 'custom_report_var') { // Modify the value of the custom report variable $var = 'modified_custom_report_var'; } }This hook modifies the behavior of a CRM report by altering the value of a custom report variable. CRM_Utils_Hook is a part of CiviCRM's package library, which is a collection of PHP classes and code that provide functionality for the CRM.