function commerce_file_feeds_processor_targets_alter in Commerce File 7
Implements hook_feeds_processor_targets_alter().
File
- ./
commerce_file.feeds.inc, line 11 - Integration with the Feeds module.
Code
function commerce_file_feeds_processor_targets_alter(&$targets, $entity_type, $bundle_name) {
$license_info = _commerce_file_collate_license_info();
foreach (field_info_instances($entity_type, $bundle_name) as $name => $instance) {
$info = field_info_field($name);
if ($info['type'] != 'commerce_file') {
continue;
}
// file import
$targets[$name . ':file'] = array(
'name' => check_plain($instance['label'] . ': File'),
'callback' => 'commerce_file_set_file_target',
'real_target' => $info['field_name'],
'description' => t('The @label field file target.', array(
'@label' => $instance['label'],
)),
);
// license data info
foreach ($license_info as $data_field => $data_info) {
$name_label = $instance['label'] . ': Data: ' . drupal_ucfirst(str_replace('_', ' ', $data_field));
$targets[$name . ':data:' . $data_field] = array(
'name' => check_plain($name_label),
'callback' => 'commerce_file_set_data_target',
'real_target' => $info['field_name'],
'description' => $data_info['property info']['description'],
);
}
}
}