From 65ddce7b0bd404dc0d3954758741011509f89855 Mon Sep 17 00:00:00 2001 From: Aidan Saunders Date: Thu, 14 Jun 2018 11:08:46 +0100 Subject: [PATCH] Render Note field tokens correctly - they are already HTML. --- Civi/Token/TokenRow.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Civi/Token/TokenRow.php b/Civi/Token/TokenRow.php index cb5982f004bf..883e29089a2e 100644 --- a/Civi/Token/TokenRow.php +++ b/Civi/Token/TokenRow.php @@ -218,6 +218,7 @@ public function fill($format = NULL) { case 'text/html': // Plain => HTML. foreach ($textTokens as $entity => $values) { + $entityFields = civicrm_api3($entity, "getFields", array('api_action' => 'get')); foreach ($values as $field => $value) { if (!isset($htmlTokens[$entity][$field])) { // CRM-18420 - Activity Details Field are enclosed within

, @@ -226,6 +227,10 @@ public function fill($format = NULL) { if ($entity == 'activity' && $field == 'details') { $htmlTokens[$entity][$field] = $value; } + elseif (\CRM_Utils_Array::value('data_type', \CRM_Utils_Array::value($field, $entityFields['values'])) == 'Memo') { + // Memo fields aka custom fields of type Note are html. + $htmlTokens[$entity][$field] = CRM_Utils_String::purifyHTML($value); + } else { $htmlTokens[$entity][$field] = htmlentities($value); }