tokenValues hook is called incorrectly, resulting in unpredictable values/emails not sending
The definition of hook_civicrm_tokenValues
specifies that the $values
argument is an "array of values, keyed by contact id".
E.g.:
$values = [
123 => [
'contact_id' => '123',
'first_name' => 'Jon',
]
];
However, api/v3/Email/Send.php
sends the $values as a single-dimension array:
$values = [
'contact_id' => '123',
'first_name' => 'Jon',
];
This leads to unpredictable results. In at least one of my extension's cases, it changes the value of preferred_communication_method
to a value that's not HTML
, Text
, or Both
, which leads to the email not sending at all.
It looks like the code @mattwire wrote in !3 (merged) to use TokenProcessor doesn't avoid this formatting issue either.