You are here

function content_taxonomy_feeds_node_processor_targets_alter in Feeds 6

Implementation of hook_feeds_node_processor_targets_alter().

See also

FeedsNodeProcessor::getMappingTargets().

File

mappers/content_taxonomy.inc, line 14
Enable the user of feeds to map taxonomy terms from the feed for the current node to content_taxonomy CCK fields.

Code

function content_taxonomy_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 (in_array($field['type'], array(
        'content_taxonomy',
      ))) {
        $name = isset($field['widget']['label']) ? $field['widget']['label'] : $field_name;
        $targets[$field_name] = array(
          'name' => check_plain($name),
          'callback' => 'content_taxonomy_feeds_set_target',
          'description' => t('The CCK @name field of the node (@type).', array(
            '@name' => $name,
            '@type' => $field['type'],
          )),
        );
      }
    }
  }
}