function text_feeds_processor_targets in Feeds 7.2
Implements hook_feeds_processor_targets().
File
- mappers/
text.inc, line 11 - On behalf implementation of Feeds mapping API for text.module.
Code
function text_feeds_processor_targets($entity_type, $bundle_name) {
$targets = array();
$text_types = array(
'text',
'text_long',
'text_with_summary',
);
foreach (field_info_instances($entity_type, $bundle_name) as $name => $instance) {
$info = field_info_field($name);
if (in_array($info['type'], $text_types)) {
$targets[$name] = array(
'name' => check_plain($instance['label']),
'callback' => 'text_feeds_set_target',
'description' => t('The @label field of the entity.', array(
'@label' => $instance['label'],
)),
);
if ($info['type'] == 'text_with_summary') {
// Allow mapping to summary.
$targets[$name . ':summary'] = array(
'name' => t('@name: Summary', array(
'@name' => $instance['label'],
)),
'callback' => 'text_feeds_set_target',
'description' => t('The @label field of the entity.', array(
'@label' => $instance['label'],
)),
'real_target' => $name,
);
}
}
if (!empty($instance['settings']['text_processing'])) {
$targets[$name]['summary_callbacks'] = array(
'text_feeds_summary_callback',
);
$targets[$name]['form_callbacks'] = array(
'text_feeds_form_callback',
);
}
}
return $targets;
}