Details
-
Type:
Improvement
-
Status: Done/Fixed
-
Priority:
Minor
-
Resolution: Won't Fix
-
Affects Version/s: 3.4.7, 4.0.7
-
Fix Version/s: Unscheduled
-
Component/s: CiviMail, Core CiviCRM
-
Labels:None
-
Documentation Required?:None
-
Funding Source:Needs Funding
Description
There are cases where it would be useful to let hook_civicrm_tokenValues() know more about the context in which it's called – for example, for which mailing the tokens will be used, or for which label.
I had thought merely to pass the mailing job ID (which the code is already attempting to do in one place), but Lobo suggested on IRC that it's even better to pass the whole mailing object or other object, in an effort to provide as much context as possible.
This patch attempts to do that.
In cases where the hook is called from a static method, a relevant object from the context is passed instead. Where a non-static method is called statically, the object passed is obviously NULL, but in that case there's not a lot of context for the hook implementation to use anyway.