You are here

function email_feeds_set_target in Feeds 6

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.

1 string reference to 'email_feeds_set_target'
email_feeds_node_processor_targets_alter in mappers/email.inc
Implementation of hook_feeds_node_processor_targets_alter().

File

mappers/email.inc, line 39
On behalf implementation of Feeds mapping API for email.module (CCK).

Code

function email_feeds_set_target($node, $target, $value) {
  $field = isset($node->{$target}) ? $node->{$target} : array();

  // Handle multiple value fields.
  if (is_array($value)) {
    $i = 0;
    foreach ($value as $v) {
      if (!is_array($v) && !is_object($v)) {
        $field[$i]['email'] = $v;
      }
      $i++;
    }
  }
  else {
    $field[0]['email'] = $value;
  }
  $node->{$target} = $field;
}