Index: mappers/money.inc
===================================================================
RCS file: mappers/money.inc
diff -N mappers/money.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ mappers/money.inc	30 Dec 2010 01:22:43 -0000
@@ -0,0 +1,60 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * On behalf implementation of Feeds mapping API for money.module (CCK).
+ */
+
+/**
+ * Implementation of hook_feeds_node_processor_targets_alter().
+ *
+ * @see FeedsNodeProcessor::getMappingTargets().
+ */
+function money_feeds_node_processor_targets_alter(&$targets, $content_type) {
+  $info = content_types($content_type);
+  $fields = array();
+
+  if (isset($info['fields']) && is_array($info['fields'])) {
+    foreach ($info['fields'] as $field_name => $field) {
+      if ($field['type'] == 'money') {
+        $fields[$field_name] = isset($field['widget']['label']) ? $field['widget']['label'] : $field_name;
+      }
+    }
+  }
+  foreach ($fields as $k => $name) {
+    $targets[$k . ':amount'] = array(
+      'name' => $name . ' (Amount)',
+      'callback' => 'money_feeds_set_target',
+      'description' => t('The Amount for the CCK money field of the node.'),
+    );
+    $targets[$k . ':currency'] = array(
+      'name' => $name . ' (Currency)',
+      'callback' => 'money_feeds_set_target',
+      'description' => t('The Currency for the CCK money field of the node.'),
+    );
+  }
+}
+
+/**
+ * Callback for mapping. Here is where the actual mapping happens.
+ *
+ * When the callback is invoked, $target contains the name of the field the
+ * user has decided to map to and $value contains the value of the feed item
+ * element the user has picked as a source.
+ */
+function money_feeds_set_target($node, $target, $value) {
+
+  list($target, $sub_field) = explode(':', $target);
+
+  $field = isset($node->$target) ? $node->$target : array();
+
+  // Handle multiple value fields.
+  $value = is_array($value) ? $value : array($value);
+
+  foreach ($value as $k => $v) {
+    $field[$k][$sub_field] = $v;
+  }
+
+  $node->$target = $field;
+}
