From 21d2903d2270e61157cad6f831dcee4424ece80a Mon Sep 17 00:00:00 2001 From: Anthony Nemirovsky Date: Thu, 13 Nov 2014 10:23:17 -0800 Subject: [PATCH] Add hook_civicrm_preProcess function. This seems to be a generically useful spot to intercept the form object and change things before the form is processed. Specifically, we need this hook for integrating the Event Cart with the CiviDiscount extension. --- CRM/Core/Form.php | 2 ++ CRM/Utils/Hook.php | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index deb7eac180..3e92e6f4bf 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -435,6 +435,8 @@ class CRM_Core_Form extends HTML_QuickForm_Page { $this->preProcess(); + CRM_Utils_Hook::preProcess(get_class($this), $this); + $this->assign('translatePermission', CRM_Core_Permission::check('translate CiviCRM')); if ( diff --git a/CRM/Utils/Hook.php b/CRM/Utils/Hook.php index 3ca5709eb2..63239d4f9d 100644 --- a/CRM/Utils/Hook.php +++ b/CRM/Utils/Hook.php @@ -302,6 +302,18 @@ abstract class CRM_Utils_Hook { return self::singleton()->invoke(6, $op, $objectName, $objectId, $links, $mask, $values, 'civicrm_links'); } + /** + * This hook is invoked during the CiviCRM form preProcess phase. + * + * @param string $formName the name of the form + * @param object $form reference to the form object + * + * @return null the return value is ignored + */ + static function preProcess($formName, &$form) { + return self::singleton()->invoke(2, $formName, $form, $formName, $formName, + } + /** * This hook is invoked when building a CiviCRM form. This hook should also * be used to set the default values of a form element -- 2.25.1