function media_feeds_feeds_processor_targets_alter in Media Feeds 7
Same name and namespace in other branches
- 7.2 media_feeds.module \media_feeds_feeds_processor_targets_alter()
Implements hook_feeds_processor_targets_alter().
File
- ./
media_feeds.module, line 11 - Implementation of the Feeds mapping API for the media module.
Code
function media_feeds_feeds_processor_targets_alter(&$targets, $entity_type, $bundle_name) {
if ($bundle_name === NULL) {
return;
}
foreach (field_info_instances($entity_type, $bundle_name) as $name => $instance) {
$info = field_info_field($name);
if ($info['type'] == 'media') {
$targets[$name] = array(
'name' => t('@label (media_internet)', array(
'@label' => $instance['label'],
)),
'callback' => 'media_feeds_set_target',
'description' => t('The @label field of the node. Value to be claimed by a Media Internet Sources provider. Be careful! The importing user will not need the @permission permission.', array(
'@label' => $instance['label'],
'@permission' => 'add media from remote sources',
)),
);
$targets[$name . ':MediaFeedsLibraryProvider'] = array(
'name' => t('@label (by filename from library)', array(
'@label' => $instance['label'],
)),
'callback' => 'media_feeds_set_target',
'description' => t('The @label field of the node. Value is a filename existing in the Media library. The importing user will not need the permission to access existing files.', array(
'@label' => $instance['label'],
)),
'summary_callback' => 'MediaFeedsLibraryProvider::summaryCallback',
'form_callback' => 'MediaFeedsLibraryProvider::formCallback',
);
if (module_exists('remote_stream_wrapper')) {
$targets[$name . ':MediaFeedsRemoteProvider'] = array(
'name' => t('@label (remote_stream_wrapper)', array(
'@label' => $instance['label'],
)),
'callback' => 'media_feeds_set_target',
'description' => t('The @label field of the node. Value is a remote URI supported by remote_stream_wrapper. The file will be referenced from a remote server instead of downloading it to the local disc.', array(
'@label' => $instance['label'],
)),
);
}
}
}
}