You are here

function range_feeds_processor_targets_alter in Range 7

Implements hook_feeds_processor_targets_alter().

See also

FeedsProcessor::getMappingTargets()

File

./range.feeds.inc, line 13
Implementation of Feeds mapping API.

Code

function range_feeds_processor_targets_alter(&$targets, $entity_type, $bundle_name) {
  $numeric_types = array(
    'range_integer',
    'range_decimal',
    'range_float',
  );
  foreach (field_info_instances($entity_type, $bundle_name) as $name => $instance) {
    $info = field_info_field($name);
    if (in_array($info['type'], $numeric_types)) {
      $targets[$name . ':from'] = array(
        'name' => t('@name: From', array(
          '@name' => $instance['label'],
        )),
        'callback' => 'range_feeds_set_target',
        'description' => t('FROM value of the @label field of the entity.', array(
          '@label' => $instance['label'],
        )),
        'real_target' => $name,
      );
      $targets[$name . ':to'] = array(
        'name' => t('@name: To', array(
          '@name' => $instance['label'],
        )),
        'callback' => 'range_feeds_set_target',
        'description' => t('TO value of the @label field of the entity.', array(
          '@label' => $instance['label'],
        )),
        'real_target' => $name,
      );
    }
  }
}