hook_civicrm_tokenValues inconsistent data
hook_civicrm_tokenValues has the following parameter signature:
&$valuesan array containing the data to be replaced. The array has an index by contact id.
$contactIDsan array of all contact ids
$jobIDid of the mailing job
$tokensarray of tokens to be replaced
$contextthe calling class
$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
$contactIdsshould 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/