You are here

function office_hours_feeds_processor_targets_alter in Office Hours 7

Implements hook_feeds_processor_targets_alter().

See also

\Feeds\FeedsNodeProcessor::getMappingTargets()

File

./office_hours.feeds.inc, line 12
Implementation of Feeds mapping API for office_hours.

Code

function office_hours_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'] == 'office_hours') {
      $targets[$name . ':day'] = array(
        'name' => $instance['label'] . ': Day',
        'callback' => 'office_hours_feeds_set_target',
        'description' => t('The day for the @name field.', array(
          '@name' => $instance['label'],
        )),
        'real_target' => $name,
      );
      $targets[$name . ':hours'] = array(
        'name' => $instance['label'] . ': Hours',
        'callback' => 'office_hours_feeds_set_target',
        'description' => t('The first set of hours for the @name field, if using start and end in 1 field.', array(
          '@name' => $instance['label'],
        )),
        'real_target' => $name,
      );
      $targets[$name . ':morehours'] = array(
        'name' => $instance['label'] . ': More hours',
        'callback' => 'office_hours_feeds_set_target',
        'description' => t('The second set of hours for the @name field, if using start and end in 1 field.', array(
          '@name' => $instance['label'],
        )),
        'real_target' => $name,
      );
      $targets[$name . ':hours:start'] = array(
        'name' => $instance['label'] . ': Hours start',
        'callback' => 'office_hours_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,
      );
      $targets[$name . ':hours:end'] = array(
        'name' => $instance['label'] . ': Hours end',
        'callback' => 'office_hours_feeds_set_target',
        'description' => t('The end date for the @name field.', array(
          '@name' => $instance['label'],
        )),
        'real_target' => $name,
      );
      $targets[$name . ':morehours:start'] = array(
        'name' => $instance['label'] . ': More hours start',
        'callback' => 'office_hours_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,
      );
      $targets[$name . ':morehours:end'] = array(
        'name' => $instance['label'] . ': More hours end',
        'callback' => 'office_hours_feeds_set_target',
        'description' => t('The end date for the @name field.', array(
          '@name' => $instance['label'],
        )),
        'real_target' => $name,
      );
    }
  }
}