function entityreference_feeds_processor_targets_alter in Entity reference 7
Implements hook_feeds_processor_targets_alter().
See also
FeedsNodeProcessor::getMappingTargets().
File
- ./
entityreference.feeds.inc, line 13 - Feeds mapping implementation for the Entity reference module
Code
function entityreference_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 ($info['type'] == 'entityreference') {
// We don't use ":guid" in key, not to break existing configurations.
$targets[$name] = array(
'name' => check_plain($instance['label'] . t(' (Entity reference by Feeds GUID)')),
'callback' => 'entityreference_feeds_set_target',
'description' => t('The field instance @label of @id matched by Feeds GUID.', array(
'@label' => $instance['label'],
'@id' => $name,
)),
);
$targets[$name . ':url'] = array(
'name' => check_plain($instance['label'] . t(' (Entity reference by Feeds URL)')),
'callback' => 'entityreference_feeds_set_target',
'description' => t('The field instance @label of @id matched by Feeds URL.', array(
'@label' => $instance['label'],
'@id' => $name,
)),
'real_target' => $name,
);
$targets[$name . ':etid'] = array(
'name' => check_plain($instance['label'] . t(' (Entity reference by Entity ID)')),
'callback' => 'entityreference_feeds_set_target',
'description' => t('The field instance @label of @id matched by Entity ID.', array(
'@label' => $instance['label'],
'@id' => $name,
)),
'real_target' => $name,
);
$targets[$name . ':label'] = array(
'name' => check_plain($instance['label'] . t(' (Entity reference by Entity label)')),
'callback' => 'entityreference_feeds_set_target',
'description' => t('The field instance @label of @id matched by Entity label.', array(
'@label' => $instance['label'],
'@id' => $name,
)),
'real_target' => $name,
);
}
}
}