hook_civicrm_tokenValues inconsistent data
The hook_civicrm_tokenValues
has the following parameter signature:
-
&$values
an array containing the data to be replaced. The array has an index by contact id. -
$contactIDs
an array of all contact ids -
$jobID
id of the mailing job -
$tokens
array of tokens to be replaced -
$context
the calling class
However the $values
and $contactIds
have a inconsistent markup. The inconsistency is visible when one does a search on cases and then select Print/Merge document from the action list and creates a PDF.
At that point the $values
also hold data for the contact with the same ID as the case ID.
And at that point the $contactIds
is an array containing the following: $contactIds[´contact_id´] = 1; $contactIds[´case_id´] = 2
Proposal / Expected behaviour
- Only expect the affected contacts in
$values
- The
$contactIds
should hold the contactIds and the case ID should be moved to $values.
I discovered this whilst writing https://docs.civicrm.org/dev/en/latest/step-by-step/create-custom-case-token/
Edited by jaapjansma