Skip to content

Commit

Permalink
Merge pull request #13280 from aydun/tokenrow_fix
Browse files Browse the repository at this point in the history
Fix  \Civi\Token\TokenRow::customToken() failure if field is not set
  • Loading branch information
seamuslee001 authored Jan 3, 2019
2 parents fddfd6a + e5e0c47 commit 44e82e1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Civi/Token/TokenRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,11 @@ public function tokens($a = NULL, $b = NULL, $c = NULL) {
*/
public function customToken($entity, $customFieldID, $entityID) {
$customFieldName = "custom_" . $customFieldID;
$fieldValue = civicrm_api3($entity, 'getvalue', array(
$record = civicrm_api3($entity, "getSingle", [
'return' => $customFieldName,
'id' => $entityID,
));
'id' => $entityID,
]);
$fieldValue = \CRM_Utils_Array::value($customFieldName, $record, '');

// format the raw custom field value into proper display value
if (isset($fieldValue)) {
Expand Down

0 comments on commit 44e82e1

Please sign in to comment.