You are here

function taxonomy_feeds_processor_targets in Feeds 7.2

Implements hook_feeds_processor_targets().

File

mappers/taxonomy.inc, line 60
On behalf implementation of Feeds mapping API for taxonomy.module.

Code

function taxonomy_feeds_processor_targets($entity_type, $bundle_name) {
  $targets = array();
  foreach (field_info_instances($entity_type, $bundle_name) as $name => $instance) {
    $info = field_info_field($name);
    if ($info['type'] == 'taxonomy_term_reference') {
      $targets[$name] = array(
        'name' => check_plain($instance['label']),
        'callback' => 'taxonomy_feeds_set_target',
        'description' => t('The @label field of the entity.', array(
          '@label' => $instance['label'],
        )),
        'summary_callbacks' => array(
          'taxonomy_feeds_summary_callback',
        ),
        'form_callbacks' => array(
          'taxonomy_feeds_form_callback',
        ),
      );
    }
  }
  if ($entity_type == 'taxonomy_term') {
    $targets['tid']['name'] = t('Term id');
    $targets['tid']['description'] = t('The tid of the taxonomy term. NOTE: use this feature with care, node ids are usually assigned by Drupal.');
    unset($targets['vocabulary']);
  }
  return $targets;
}