function physical_feeds_processor_targets_alter in Physical Fields 7
Implements hook_feeds_processor_targets_alter().
Parameters
$targets: Array containing the targets to be offered to the user.
$entity_type: The entity type of the target, for instance a 'node' entity.
$bundle_name: The bundle name for which to alter targets.
File
- ./
physical.feeds.inc, line 18 - Feeds processor hooks for importing physical fields using the Feeds module.
Code
function physical_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 (in_array($info['type'], array(
'physical_weight',
'physical_dimensions',
'physical_volume',
))) {
foreach ($info['columns'] as $sub_field => $schema_info) {
$name_label = $instance['label'] . ': ' . drupal_ucfirst(str_replace('_', ' ', $sub_field));
$targets[$name . ':' . $sub_field] = array(
'name' => $name_label,
'callback' => 'physical_feeds_set_target',
'real_target' => $info['field_name'],
'description' => $schema_info['description'],
);
}
}
}
}