function countries_feeds_processor_targets_alter in Countries 8
Same name and namespace in other branches
- 7.2 countries.feeds.inc \countries_feeds_processor_targets_alter()
- 7 countries.module \countries_feeds_processor_targets_alter()
Implements hook_feeds_processor_targets_alter().
Parameters
array $targets: Array containing the targets to be offered to the user.
string $entity_type: The entity type of the target, for instance a 'node' entity.
string $bundle_name: The bundle name for which to alter targets.
File
- ./
countries.feeds.inc, line 17 - Feeds processor hooks for importing Countries fields using the Feeds module.
Code
function countries_feeds_processor_targets_alter(&$targets, $entity_type, $bundle_name) {
foreach (field_info_instances($entity_type, $bundle_name) as $field_name => $instance) {
$info = field_info_field($field_name);
if ($info['type'] == 'country') {
$core_properties = countries_core_properties();
unset($core_properties['enabled']);
unset($core_properties['continent']);
foreach ($core_properties as $key => $label) {
$targets[$entity_type . ':' . $bundle_name . ':' . $field_name . ':' . $key] = array(
'name' => check_plain($instance['label']) . ': ' . $label,
'callback' => '_countries_feeds_set_target',
'description' => t('The @label field of the node.', array(
'@label' => $instance['label'],
)),
);
}
}
}
}