You are here

function fraction_feeds_processor_targets in Fraction 7

Implements hook_feeds_processor_targets().

File

./fraction.feeds.inc, line 10

Code

function fraction_feeds_processor_targets($entity_type, $bundle_name) {
  $targets = array();

  // Add targets for each Fraction field instance.
  foreach (field_info_instances($entity_type, $bundle_name) as $name => $instance) {
    $info = field_info_field($name);
    if ($info['type'] == 'fraction') {
      $targets[$name] = array(
        'name' => check_plain($instance['label']) . ' (' . t('decimal') . ')',
        'callback' => 'fraction_feeds_set_target',
        'description' => t('The @label field of the entity.', array(
          '@label' => $instance['label'],
        )),
      );
      $targets[$name . ':fraction'] = array(
        'name' => check_plain($instance['label']) . ' (' . t('fraction') . ')',
        'callback' => 'fraction_feeds_set_target',
        'description' => t('The @label field of the entity (fraction).', array(
          '@label' => $instance['label'],
        )),
      );
      $targets[$name . ':numerator'] = array(
        'name' => check_plain($instance['label']) . ' (' . t('numerator') . ')',
        'callback' => 'fraction_feeds_set_target',
        'description' => t('The @label field of the entity (numerator value).', array(
          '@label' => $instance['label'],
        )),
      );
      $targets[$name . ':denominator'] = array(
        'name' => check_plain($instance['label']) . ' (' . t('denominator') . ')',
        'callback' => 'fraction_feeds_set_target',
        'description' => t('The @label field of the entity (denominator value).', array(
          '@label' => $instance['label'],
        )),
      );
    }
  }
  return $targets;
}