You are here

function countries_feeds_processor_targets_alter in Countries 7

Same name and namespace in other branches
  1. 8 countries.feeds.inc \countries_feeds_processor_targets_alter()
  2. 7.2 countries.feeds.inc \countries_feeds_processor_targets_alter()

Implements hook_feeds_processor_targets_alter().

File

./countries.module, line 667

Code

function countries_feeds_processor_targets_alter(&$targets, $entity_type, $bundle_name) {
  foreach (field_info_instances($entity_type, $bundle_name) as $field_name => $instance) {
    $info = field_info_field($field_name);
    if ($info['type'] == 'country') {
      $core_properties = array(
        'name' => t('Name'),
        'iso2' => t('ISO alpha-2 code'),
        'iso3' => t('ISO alpha-3 code'),
        'official_name' => t('Official name'),
        'numcode' => t('ISO numeric-3 code'),
      );
      foreach ($core_properties as $key => $label) {
        $targets[$entity_type . ':' . $bundle_name . ':' . $field_name . ':' . $key] = array(
          'name' => check_plain($instance['label']) . ': ' . $label,
          'callback' => 'countries_feeds_processor_targets_alter_callback',
          'description' => t('The @label field of the node.', array(
            '@label' => $instance['label'],
          )),
        );
      }
    }
  }
}