From: jitendrapurohit Date: Mon, 2 Nov 2015 10:13:46 +0000 (+0530) Subject: CRM-9428 - Using custom field data specified with hook_civicrm_customFieldOptions... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2a218647483a6017fd8525ad3cd1bdc03e49af9e;p=civicrm-core.git CRM-9428 - Using custom field data specified with hook_civicrm_customFieldOptions in reports --- diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index 6555a2dcf5..7f509641b3 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -1118,6 +1118,10 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { $attributes = &$option['attributes']; $html_type = $attributes['html_type']; $data_type = $attributes['data_type']; + // set $id as $fieldID if not passed in the params. + if (empty($fieldID)) { + $fieldID = $id; + } return self::getDisplayValueCommon($value, $option, @@ -1159,6 +1163,11 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { $html_type == 'Multi-Select' ) ) { + // Keep only the custom option 'key' => 'value' pair + // to avoid return of unnecessary data from the hook. + if (isset($option['attributes'])) { + unset($option['attributes']); + } CRM_Utils_Hook::customFieldOptions($fieldID, $option); }