From: deb.monish Date: Tue, 24 Oct 2017 12:29:25 +0000 (+0530) Subject: CRM-21322: create hook to modify entityRef fields X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=33f073749968ec653555386a35a017d0f3378923;p=civicrm-core.git CRM-21322: create hook to modify entityRef fields --- diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 99a091d64f..a4e328cb4d 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -1873,6 +1873,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * @param $props */ private function formatReferenceFieldAttributes(&$props) { + CRM_Utils_Hook::alterEntityRefParams($props); $props['data-select-params'] = json_encode($props['select']); $props['data-api-params'] = $props['api'] ? json_encode($props['api']) : NULL; $props['data-api-entity'] = $props['entity']; diff --git a/CRM/Utils/Hook.php b/CRM/Utils/Hook.php index 4f0b0c3713..78ae0bc6b1 100644 --- a/CRM/Utils/Hook.php +++ b/CRM/Utils/Hook.php @@ -2382,4 +2382,18 @@ abstract class CRM_Utils_Hook { return self::singleton()->invoke(array('message'), $message, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_inboundSMS'); } + /** + * This hook is called to modify api params of EntityRef form field + * + * @param array $params + * + * @return mixed + */ + public static function alterEntityRefParams(&$params) { + return self::singleton()->invoke(array('params'), $params, self::$_nullObject, + self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, + 'civicrm_alterEntityRefParams' + ); + } + }