From 2a218647483a6017fd8525ad3cd1bdc03e49af9e Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Mon, 2 Nov 2015 15:43:46 +0530 Subject: [PATCH] CRM-9428 - Using custom field data specified with hook_civicrm_customFieldOptions in reports --- CRM/Core/BAO/CustomField.php | 9 +++++++++ 1 file changed, 9 insertions(+) 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); } -- 2.25.1