CRM-21322: create hook to modify entityRef fields
authordeb.monish <monish.deb@jmaconsulting.biz>
Tue, 24 Oct 2017 12:29:25 +0000 (17:59 +0530)
committerdeb.monish <monish.deb@jmaconsulting.biz>
Tue, 24 Oct 2017 12:29:25 +0000 (17:59 +0530)
CRM/Core/Form.php
CRM/Utils/Hook.php

index 99a091d64f5fa783ec1e028d8b1c610871b25b58..a4e328cb4da1b17a7438c742cb1720dc08104b40 100644 (file)
@@ -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'];
index 4f0b0c3713259f364e21a473976e60c2642ae425..78ae0bc6b1a9bab9bf6320993d3b07850a044742 100644 (file)
@@ -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'
+    );
+  }
+
 }