function file_feeds_processor_targets_alter in Feeds 8.2
Same name and namespace in other branches
- 7 mappers/file.inc \file_feeds_processor_targets_alter()
Implements hook_feeds_processor_targets_alter().
See also
FeedsNodeProcessor::getMappingTargets()
File
- mappers/
file.inc, line 16 - On behalf implementation of Feeds mapping API for file.module and image.module.
Code
function file_feeds_processor_targets_alter(&$targets, $entity_type, $bundle_name) {
foreach (field_info_instances($entity_type, $bundle_name) as $name => $instance) {
$info = field_info_field($name);
if (in_array($info['type'], array(
'file',
'image',
))) {
$targets[$name . ':uri'] = array(
'name' => t('@label: URI', array(
'@label' => $instance['label'],
)),
'callback' => 'file_feeds_set_target',
'description' => t('The URI of the @label field.', array(
'@label' => $instance['label'],
)),
'real_target' => $name,
);
if ($info['type'] == 'image') {
$targets[$name . ':alt'] = array(
'name' => t('@label: Alt', array(
'@label' => $instance['label'],
)),
'callback' => 'file_feeds_set_target',
'description' => t('The alt tag of the @label field.', array(
'@label' => $instance['label'],
)),
'real_target' => $name,
);
$targets[$name . ':title'] = array(
'name' => t('@label: Title', array(
'@label' => $instance['label'],
)),
'callback' => 'file_feeds_set_target',
'description' => t('The title of the @label field.', array(
'@label' => $instance['label'],
)),
'real_target' => $name,
);
}
}
}
}