You are here

function timefield_feeds_processor_targets_alter in Timefield 7

Implements hook_feeds_processor_targets_alter().

See also

FeedsNodeProcessor::getMappingTargets()

File

./timefield.feeds.inc, line 13
Integration with the Feeds module.

Code

function timefield_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 ($info['type'] == 'timefield') {
      $targets[$name . ':start'] = array(
        'name' => t('@name: Start', array(
          '@name' => $instance['label'],
        )),
        'callback' => 'timefield_feeds_set_target',
        'description' => t('The start time for the @name field. Also use if mapping both start and end.', array(
          '@name' => $instance['label'],
        )),
        'real_target' => $name,
      );
      $targets[$name . ':end'] = array(
        'name' => t('@name: End', array(
          '@name' => $instance['label'],
        )),
        'callback' => 'timefield_feeds_set_target',
        'description' => t('The end time for the @name field.', array(
          '@name' => $instance['label'],
        )),
        'real_target' => $name,
      );
    }
  }
}