function link_feeds_node_processor_targets_alter in Feeds 6
Same name and namespace in other branches
- 7 mappers/link.inc \link_feeds_node_processor_targets_alter()
Implementation of hook_feeds_node_processor_targets_alter().
File
- mappers/
link.inc, line 11 - On behalf implementation of Feeds mapping API for link.module (CCK).
Code
function link_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 (in_array($field['type'], array(
'link',
))) {
$name = isset($field['widget']['label']) ? $field['widget']['label'] : $field_name;
$targets[$field_name . ':url'] = array(
'name' => t('@field_name (URL)', array(
'@field_name' => $name,
)),
'callback' => 'link_feeds_set_target',
'description' => t('The URL for the CCK @name field of the node.', array(
'@name' => $name,
)),
'real_target' => $field_name,
);
//Provides a mapping target for the field title if used.
if (in_array($field['title'], array(
'optional',
'required',
))) {
$targets[$field_name . ':title'] = array(
'name' => t('@name (title)', array(
'@name' => $name,
)),
'callback' => 'link_feeds_set_target',
'description' => t('The title for the CCK @name field of the node.', array(
'@name' => $name,
)),
'real_target' => $field_name,
);
}
}
}
}
}