I try to add text to the existing token [order-payment-method]. I want it to include the variable_get('uc_check_policy', '') when a check was used as payment method. How do you override the existing token_value function to do this?
Wed, 05/27/2009 - 07:07
Re: How to add text to an existing token?
Might be easier to simply add a new token [check-policy] than to try to override an existing token.
What is wrong with this?
I added this in uc_payment_pack.module:
<?php
/**
* Implementation of hook_token_list().
*/
function uc_payment_pack_token_list($type = 'all') {
$tokens['global']['check-policy'] = t('The check policy');
return $tokens;
}
/**
* Implementation of hook_token_values().
*/
function uc_payment_pack_token_values($type, $object = NULL) {
switch ($type) {
case 'global':
if (!empty($object)) {
$values['check-policy'] = variable_get('uc_check_policy','');
}
break;
}
return
$values;
}
?>I see the new token under Global tokens in /admin/store/help/tokens but when I put the token in modules/ubercart/uc_order/templates/customer.itpl.php , it is not replaced, just [check-policy] appears.
Include Check policy in orders and invoices
I uploaded a patch here that seems to work correctly.

