Skip to content

Commit

Permalink
Merge pull request #13283 from aydun/token_note_fix
Browse files Browse the repository at this point in the history
Render Note field tokens correctly - they are already HTML.
  • Loading branch information
seamuslee001 authored Mar 6, 2019
2 parents 7e862b9 + 65ddce7 commit d03484b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Civi/Token/TokenRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <p>,
Expand All @@ -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);
}
Expand Down

0 comments on commit d03484b

Please sign in to comment.