You are here

function datetime_feeds_processor_targets_alter in Feeds 8.2

Implements hook_feeds_processor_targets_alter().

@todo Only provides "end date" target if field allows it.

See also

FeedsNodeProcessor::getMappingTargets().

File

mappers/datetime.inc, line 18
On behalf implementation of Feeds mapping API for date

Code

function datetime_feeds_processor_targets_alter(&$targets, $entity_type, $bundle) {
  foreach (field_info_instances($entity_type, $bundle) as $name => $instance) {
    $info = field_info_field($name);
    if ($info['type'] === 'datetime') {
      $targets[$name] = array(
        'name' => t('@name: Start', array(
          '@name' => $instance['label'],
        )),
        'callback' => 'datetime_feeds_set_target',
        'description' => t('The start date for the @name field. Also use if mapping both start and end.', array(
          '@name' => $instance['label'],
        )),
        'real_target' => $name,
      );
    }
  }
}