You are here

function link_feeds_processor_targets_alter in Feeds 8.2

Implements hook_feeds_processor_targets_alter().

See also

FeedsProcessor::getMappingTargets()

File

mappers/link.inc, line 13
On behalf implementation of Feeds mapping API for link.module.

Code

function link_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'] == 'link') {
      if (array_key_exists('url', $info['columns'])) {
        $targets[$name . ':url'] = array(
          'name' => t('@name: URL', array(
            '@name' => $instance['label'],
          )),
          'callback' => 'link_feeds_set_target',
          'description' => t('The @label field of the entity.', array(
            '@label' => $instance['label'],
          )),
          'real_target' => $name,
        );
      }
      if (array_key_exists('title', $info['columns'])) {
        $targets[$name . ':title'] = array(
          'name' => t('@name: Title', array(
            '@name' => $instance['label'],
          )),
          'callback' => 'link_feeds_set_target',
          'description' => t('The @label field of the entity.', array(
            '@label' => $instance['label'],
          )),
          'real_target' => $name,
        );
      }
    }
  }
}