function emfield_feeds_set_target in Feeds 7
Same name and namespace in other branches
- 6 mappers/emfield.inc \emfield_feeds_set_target()
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 'emfield_feeds_set_target'
- emfield_feeds_node_processor_targets_alter in mappers/
emfield.inc - Implements hook_feeds_node_processor_targets_alter().
File
- mappers/
emfield.inc, line 40 - On behalf implementation of Feeds mapping API for emfield.module (Embedded Media Field).
Code
function emfield_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]['embed'] = $v;
}
$i++;
}
}
else {
$field[0]['embed'] = $value;
}
$node->{$target} = $field;
}