Details
-
Type: Improvement
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.0.4
-
Fix Version/s: 4.1.0
-
Component/s: Core CiviCRM
-
Labels:None
Description
The attached patch provides a new function to eventually replace CRM_Utils_Hook::tokenValues. It allows the functions implementing the hook to make two improvements: 1) to only calculate the tokens needed for a particular template, rather than all templates, and 2) to calculate tokens for base objects other contacts, eg on the objects in a Contribution Search that are being used to send an email.
Perhaps I'm overlooking something, but I couldn't see how to provide backward compatibility for a hook definition when the implementations are non-core and i wanted to increase the number of parameters. That's why this is a new hook.
If this approach is deemed promising, then various strategies could be used to transition to the new approach. We could force the use of the new hook. Alternatively, the calling functions, sendTemplate and sendReminder, would likely need to call a special function to check each module to see if implemented hook_tokenValues or hook_tokenValuesNeeded; if the latter existed it would be called, if only the former, then it would be called.