The attached patch provides support for saving the email address value for a redhen_email field. It probably wouldn't be very difficult to add support for the other field properties (home, bulk mailing status, etc), I just didn't need it for my particular project.

This patch steals heavily from #5 on #1361084: Feeds Mapper for Phone field needed.

Comments

jlyon’s picture

When I ran my import the default parameter wasn't set so $redhen_contact->email was NULL. I fixed it by running a VBO, but clearly a little more work here is necessary.

nedjo’s picture

Status: Needs review » Needs work

Thanks for posting the patch. This would be a welcome addition. I haven't tested. Here are some minor issues.

+++ b/modules/redhen_fields/redhen_fields.feeds.inc
@@ -0,0 +1,56 @@
+ * On behalf implementation of Feeds mapping API for link.module.

Should be redhen_fields.module rather than link.module.

+++ b/modules/redhen_fields/redhen_fields.feeds.inc
@@ -0,0 +1,56 @@
+        'description' => t('The email address value.', array('@label' => $instance['label'])),

The label parameter isn't used and so should be dropped:

+        'description' => t('The email address value.'),
+++ b/modules/redhen_fields/redhen_fields.feeds.inc
@@ -0,0 +1,56 @@
+      $field['und'][$i]['value'] = $v;

Should use the LANGUAGE_NONE constant rather than the string 'und':

+      $field[LANGUAGE_NONE][$i]['value'] = $v;
jlyon’s picture

StatusFileSize
new1.86 KB

Here's an updated version of the patch addressing the points above. Thanks for putting that together. Guess I was a little sloppy when I put it together.

Re: LANGUAGE_NONE: I think we might want to use $field->language or something similar to truly make it multi-lingual, although I haven't done any testing with this:

$field[$field->language][$i]['value'] = $v;

levelos’s picture

Assigned: Unassigned » bleedev

Perhaps in a redhen.feeds.inc file?

bleedev’s picture

Assigned: bleedev » Unassigned
Status: Needs work » Postponed

Feeds does not currently handle "non-core entities" (see http://drupal.org/node/1033202). Once Feeds resolves this issue, this issue could be re-opened.

bleedev’s picture

Also, note that the redhen_fields_feeds_set_target function is missing the $mapping variable, which the language would then be set with:

// Set the language of the field depending on the mapping.
$language = isset($mapping['language']) ? $mapping['language'] : LANGUAGE_NONE;
levelos’s picture

Status: Postponed » Closed (duplicate)