I can't find the token replacements for my various money cck fields. It says in the description of the module that this should be supported. Any pointers?

CommentFileSizeAuthor
#1 money-6.x-1.x-dev--token.patch1.26 KBperarnet

Comments

perarnet’s picture

StatusFileSize
new1.26 KB

Please have a look at attached patch, works fine for me now.

drewski803’s picture

Category: bug » support
Status: Active » Needs review

Also, include support for the formatted version.

/**
 * Add money fields to token list
 **/

function money_token_list($type = 'all') {
  if ($type == 'field' || $type == 'all') {
    $tokens = array();

    $tokens['money']['amount'] = t("Money amount");
    $tokens['money']['currency'] = t("Currency type");
    $tokens['money']['formatted'] = t("The formatted value");

    return $tokens;
  }
}

/**
 * Link tokens to the cck fields
 */
function money_token_values($type, $object = NULL) {
  if ($type == 'field') {
    $item = $object[0];

    $tokens['amount'] = $item['amount'];
    $tokens['currency'] = $item['currency'];
    $tokens['formatted'] = $item['view'];

    return $tokens;
  }
}
ymmatt’s picture

I used the latest patch and it worked great for me, needs to be patched into the module.

markus_petrux’s picture

Title: Token does not work » Token support is missing
Category: support » bug
Status: Needs review » Needs work

Please, provide the these functions on a separate files in the includes directory. In the same way the integration with diff is done. Thanks