Skip to content

Commit

Permalink
fix for greeting token
Browse files Browse the repository at this point in the history
  • Loading branch information
monishdeb committed Jan 10, 2017
1 parent 213677d commit cd76606
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Civi/Token/AbstractTokenSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,12 @@ public function evaluateTokens(TokenValueEvent $e) {
/**
* Populate the custom field and other remaining entity token data.
*
* @param TokenRow $e
* @param TokenRow $row
* The record for which we want token values.
* @param string $entity
* The entity for which we want the token values
* @param array $tokens
* The array of tokens whose data need to be fetched
* The array of tokens whose data need to be fetched
*/
public function evaluateExtraToken(TokenRow $row, $entity, $tokens) {
if (empty($tokens)) {
Expand Down
18 changes: 9 additions & 9 deletions Civi/Token/TokenCompatSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ public function onEvaluate(TokenValueEvent $e) {
$contactTokens = \CRM_Utils_Array::value('contact', $messageTokens);
if (!empty($contactTokens)) {
try {
$result = civicrm_api3('Contact', 'getsingle', array(
$result = civicrm_api3('Contact', 'getsingle', array(
'id' => $contactId,
'return' => $contactTokens,
));
$contact = array_merge($contact, $result);
}
catch (CiviCRM_API3_Exception $e) {
//do nothing
}
));
$contact = array_merge($contact, $result);
}
catch (CiviCRM_API3_Exception $e) {
//do nothing
}
}
}
else {
Expand Down Expand Up @@ -116,12 +116,12 @@ public function onRender(TokenRenderEvent $e) {
$e->string = \CRM_Utils_Token::replaceDomainTokens($e->string, \CRM_Core_BAO_Domain::getDomain(), $isHtml, $e->message['tokens'], $useSmarty);

if (!empty($e->context['contact'])) {
\CRM_Utils_Token::replaceGreetingTokens($e->string, $e->context['contact'], $e->context['contact']['contact_id'], NULL, FALSE);

$e->string = \CRM_Utils_Token::replaceContactTokens($e->string, $e->context['contact'], $isHtml, $e->message['tokens'], FALSE, $useSmarty);

// FIXME: This may depend on $contact being merged with hook values.
$e->string = \CRM_Utils_Token::replaceHookTokens($e->string, $e->context['contact'], $e->context['hookTokenCategories'], $isHtml, $useSmarty);

\CRM_Utils_Token::replaceGreetingTokens($e->string, NULL, $e->context['contact']['contact_id'], NULL, $useSmarty);
}

if ($useSmarty) {
Expand Down

0 comments on commit cd76606

Please sign in to comment.