You are here

function content_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 'content_feeds_set_target'
content_feeds_node_processor_targets_alter in mappers/content.inc
Implementation of hook_feeds_node_processor_targets_alter().

File

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

Code

function content_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]['value'] = $v;
      }
      $i++;
    }
  }
  else {
    $field[0]['value'] = $value;
  }
  $node->{$target} = $field;
}