function money_feeds_set_target_amount in Money field 7
1 string reference to 'money_feeds_set_target_amount'
- money_feeds_node_processor_targets_alter in includes/
money.feeds.inc - Implements hook_feeds_node_processor_targets_alter().
File
- includes/
money.feeds.inc, line 36 - Integration of Money field with the feeds module.
Code
function money_feeds_set_target_amount($node, $target, $value) {
// use just the field name as the target
$target = drupal_substr($target, 0, strrpos($target, '_'));
$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]['amount'] = $v;
}
$i++;
}
}
else {
$field[0]['amount'] = $value;
}
$node->{$target} = $field;
}