From 75c4fcec37be383d64c0c1d3b64329f2563a355a Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 18 Apr 2019 13:52:25 -0400 Subject: [PATCH] Fix creating Formatting fields in api and UI --- CRM/Core/BAO/UFField.php | 1 + api/v3/utils.php | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CRM/Core/BAO/UFField.php b/CRM/Core/BAO/UFField.php index 9717f8ff35..546476b4de 100644 --- a/CRM/Core/BAO/UFField.php +++ b/CRM/Core/BAO/UFField.php @@ -1086,6 +1086,7 @@ SELECT id */ public static function getAvailableFieldTitles() { $fields = self::getAvailableFieldsFlat(); + $fields['formatting'] = ['title' => ts('Formatting')]; return CRM_Utils_Array::collect('title', $fields); } diff --git a/api/v3/utils.php b/api/v3/utils.php index bac0826f5c..1e5d383640 100644 --- a/api/v3/utils.php +++ b/api/v3/utils.php @@ -2338,6 +2338,11 @@ function _civicrm_api3_api_match_pseudoconstant_value(&$value, $options, $fieldN return; } + // Hack for Profile formatting fields + if ($fieldName === 'field_name' && (strpos($value, 'formatting') === 0)) { + return; + } + // Translate value into key // Cast $value to string to avoid a bug in array_search $newValue = array_search((string) $value, $options); -- 2.25.1