﻿? money-6.x-1.x-dev--token.patch
Index: money.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/money/money.module,v
retrieving revision 1.1
diff -u -p -r1.1 money.module
--- money.module        9 Aug 2007 13:39:45 -0000       1.1
+++ money.module        18 Aug 2010 20:03:05 -0000
@@ -352,6 +352,34 @@ function _money_get_digit_group_separato
   return (!empty($digit_group_separator)) ? $digit_group_separator : ' ';
 }

+/**
+ * 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("Money in currency");
+
+    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'];
+
+    return $tokens;
+  }
+}
+

 //----------------------------------------------------------------------------
 // Theming functions.
@@ -385,3 +413,4 @@ function theme_money_field_settings_curr
 /**
  * @} End of "ingroup themeable".
  */
+
