You are here

function content_feeds_node_processor_targets_alter in Feeds 6

Implementation of hook_feeds_node_processor_targets_alter().

See also

FeedsNodeProcessor::getMappingTargets().

File

mappers/content.inc, line 13
On behalf implementation of Feeds mapping API for content.module (CCK).

Code

function content_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(
        'text',
        'number_integer',
        'number_decimal',
        'number_float',
      ))) {
        $fields[$field_name] = isset($field['widget']['label']) ? $field['widget']['label'] : $field_name;
      }
    }
  }
  foreach ($fields as $k => $name) {
    $targets[$k] = array(
      'name' => check_plain($name),
      'callback' => 'content_feeds_set_target',
      'description' => t('The CCK @name field of the node.', array(
        '@name' => $name,
      )),
    );
  }
}