You are here

function asin_feeds_node_processor_targets_alter in Amazon Product Advertisement API 6

Implementation of hook_feeds_node_processor_targets_alter().

See also

FeedsNodeProcessor::getMappingTargets().

File

asin/asin.module, line 467
Defines a field type for referencing an Amazon product.

Code

function asin_feeds_node_processor_targets_alter(&$targets, $content_type) {
  $info = content_types($content_type);
  $fields = array();
  if (isset($info['fields']) && count($info['fields'])) {
    foreach ($info['fields'] as $field_name => $field) {
      if ($field['type'] == 'asin') {
        $fields[$field_name] = isset($field['widget']['label']) ? $field['widget']['label'] : $field_name;
      }
    }
  }
  foreach ($fields as $k => $name) {
    $targets[$k] = array(
      'name' => $name,
      'callback' => 'asin_feeds_set_target',
      'description' => t('The CCK !name field of the node.', array(
        '!name' => $name,
      )),
    );
  }
}