I’m trying to make a custom token to present grouped donations in a thank you letter in a friendlier format. If I use the ‘Group contribution by contact’ option the {contribution.total_amount} and {contribution.receive_date} tokens generate something like this:
Donation Amount $ 5.00, 10.00
Date of Donation September 14th, 2019, September 12th, 2019
I’ve setup hook functions to define a new token meant to display each donation and date on the same line, and to provide a total at the end of the list. If I could access the donation tokens in my function for hook_civicrm_tokenValues I could easily re-arrange the data as desired. But even though the $tokens parameter indicates that my template uses {contribution.total_amount} and {contribution.receive_date}, the $values parameter does not include the relevant contribution tokens, just contact tokens:
$values (as displayed by a temp debug token) Array ( [2] => Array ( [contact_id] => 2 [display_name] => Don Alexander [postal_greeting_id] => 1 [postal_greeting_display] => Dear Don [postal_greeting_custom] => [address_id] => 1891 [street_address] => 1069 Steele Hollow Rd [supplemental_address_1] => [city] => Spencer [postal_code_suffix] => 8133 [postal_code] => 25276 [state_province_id] => 1047 [civicrm_value_spouse_tokens_7_id] => 1 [custom_16] => Mary [custom_17] => Don Alexander, Mary Wildfire [postal_greeting] => Dear Don [state_province_name] => West Virginia ) )
Is there any way to access/modify contribution tokens from within hook_civicrm_tokenValues?