### Eclipse Workspace Patch 1.0
#P D6
Index: mappers/spaces_og.inc
===================================================================
--- mappers/spaces_og.inc (revision 0)
+++ spaces_og.inc (revision 0)
@@ -0,0 +1,86 @@
+<?php
+
+/**
+ * @file
+ * Implementation of mapping hooks for Spaces OG module.
+ */
+
+/**
+ * Implementation of hook_feeds_node_processor_targets_alter().
+ */
+function spaces_og_feeds_node_processor_targets_alter(&$targets, $content_type) {
+  if (in_array($content_type, og_get_types('group_post'))) {
+    $targets['spaces_og_audience:title'] = array(
+      'name' => t('Spaces OG Audience (by title)'),
+      'callback' => 'spaces_og_feeds_set_target',
+      'description' => t('The Spaces OG Audience, matched by the OG node title.', array('@field_label' => $field_label)),
+      'real_target' => 'spaces_og_audience',
+    );
+    $targets['spaces_og_audience:nid'] = array(
+      'name' => t('Spaces OG Audience (by nid)'),
+      'callback' => 'spaces_og_feeds_set_target',
+      'description' => t('The Spaces OG Audience, matched by the OG node ID.', array('@field_label' => $field_label)),
+      'real_target' => 'spaces_og_audience',
+    );
+    $targets['spaces_og_audience:url'] = array(
+      'name' => t('Spaces OG Audience (by Feeds URL)'),
+      'callback' => 'spaces_og_feeds_set_target',
+      'description' => t('The Spaces OG Audience, matched by Feeds URL.', array('@field_label' => $field_label)),
+      'real_target' => 'spaces_og_audience',
+    );
+    $targets['spaces_og_audience:guid'] = array(
+      'name' => t('Spaces OG Audience (by Feeds GUID)'),
+      'callback' => 'spaces_og_feeds_set_target',
+      'description' => t('The Spaces OG Audience, matched by Feeds GUID.', array('@field_label' => $field_label)),
+      'real_target' => 'spaces_og_audience',
+    );
+  }
+}
+
+/**
+ * Callback for mapping.
+ */
+function spaces_og_feeds_set_target($node, $target, $value) {
+ // Determine whether we are matching against the title, nid, URL or GUID.
+  list($target, $match_key) = explode(':', $target, 2);
+
+  // Allow for multiple-value fields.
+  $value = is_array($value) ? $value : array($value);
+
+  // Match values against nodes and set nid.
+  foreach ($value as $v) {
+    $nid = NULL;
+
+    switch ($match_key) {
+      case 'url':
+      case 'guid':
+        // Lookup node ID by Feeds unique value.
+        if ($nid = db_result(db_query("SELECT nid FROM {feeds_node_item} WHERE %s = '%s'", $match_key, $v))) {
+          // Ensure nid is a valid node id for this field (and use first result).
+          $nid = key(_og_feeds_potential_references('', NULL, array($nid)));
+        }
+        break;
+
+      case 'title':
+        // Validate title.
+        if ((is_string($v) && $v !== '') || is_numeric($v)) {
+          // Lookup potential exact matches for the value (and use first result).
+          $nid = key(_og_feeds_potential_references($v, 'equals', array(), 1));
+        }
+        break;
+
+      case 'nid':
+        // Ensure nid is a valid node id for this field (and use first result).
+        $nid = key(_og_feeds_potential_references('', NULL, array($v)));
+        break;
+    }
+
+    if (empty($nid)) {
+      // Alert if no match is found.
+      drupal_set_message(t("'%value' does not match a valid node %key for Spaces OG Audience.", array('%value' => $v, '%key' => $match_key)));
+    }
+  }
+
+  // Set the last matched value
+  $node->{$target} = $nid;
+}
\ No newline at end of file