function money_feeds_node_processor_targets_alter in Money field 7
Implements hook_feeds_node_processor_targets_alter().
See also
FeedsNodeProcessor::getMappingTargets()
File
- includes/
money.feeds.inc, line 12 - Integration of Money field with the feeds module.
Code
function money_feeds_node_processor_targets_alter(&$targets, $content_type) {
$info = content_types($content_type);
$fields = array();
if (isset($info['fields']) && count($info['fields'])) {
foreach ($info['fields'] as $field_name => $field) {
if ($field['type'] == 'money') {
$fields[$field_name] = isset($field['widget']['label']) ? $field['widget']['label'] : $field_name;
}
}
}
foreach ($fields as $k => $name) {
$targets[$k . '_amount'] = array(
'name' => $name . ' (Amount)',
'callback' => 'money_feeds_set_target_amount',
'description' => t('The value of the node\'s Money field called "!name".', array(
'!name' => $name,
)),
);
$targets[$k . '_currency'] = array(
'name' => $name . ' (Currency)',
'callback' => 'money_feeds_set_target_currency',
'description' => t('The currency of the node\'s Money field called "!name".', array(
'!name' => $name,
)),
);
}
}