$escapeSmarty
);
}
+ // check if there are still any unevaluated tokens
+ $greetingTokens = self::getTokens($tokenString);
+
+ // $greetingTokens not empty, there are hook tokens to replace
+ if (!empty($greetingTokens) ) {
+ // Fill the return properties array
+ reset($greetingTokens);
+ $greetingsReturnProperties = array();
+ while(list($key) = each($greetingTokens)) {
+ $props = array_flip(CRM_Utils_Array::value($key, $greetingTokens));
+ $props = array_fill_keys(array_keys($props), 1);
+ $greetingsReturnProperties = $greetingsReturnProperties + $props;
+ }
+ $contactParams = array('contact_id' => $contactId);
+ $greetingDetails = self::getTokenDetails($contactParams,
+ $greetingsReturnProperties,
+ FALSE, FALSE, NULL,
+ $greetingTokens,
+ $className
+ );
+ // Prepare variables for calling replaceHookTokens
+ $categories = array_keys($greetingTokens);
+ list($contact) = $greetingDetails;
+ // Replace tokens defined in Hooks.
+ $tokenString = CRM_Utils_Token::replaceHookTokens($tokenString, $contact[$contactId], $categories);
+ }
}
}
// Group by entity
else {
$split = explode('.', trim($k, '{}'));
- $entity = isset($split[1]) ? ucfirst($split[0]) : 'Contact';
+ if (isset($split[1])) {
+ $entity = array_key_exists($split[1], CRM_Core_DAO_Address::export()) ? 'Address' : ucfirst($split[0]);
+ }
+ else {
+ $entity = 'Contact';
+ }
$sorted[ts($entity)][] = array('id' => $k, 'text' => $v);
}
}