You are here

function languagefield_feeds_processor_targets_alter in Custom Language field 7

Implements feeds_processor_target_alter().

Parameters

$targets array of target fields:

$entity_type:

$bundle_name:

File

./languagefield.feeds.inc, line 14
A feeds mapper for language_field field of languagefield.module.

Code

function languagefield_feeds_processor_targets_alter(&$targets, $entity_type, $bundle_name) {
  foreach (field_info_instances($entity_type, $bundle_name) as $name => $instance) {
    $info = field_info_field($name);
    if ($info['type'] == 'language_field') {
      $targets[$name] = array(
        'name' => check_plain($instance['label']),
        'callback' => 'languagefield_feeds_set_target',
        'description' => t('The @label field of the node.', array(
          '@label' => $instance['label'],
        )),
      );

      // Avoid confusion with node/user/entity language, which is called 'Language' in the field list.
      $targets[$name]['name'] .= ' (' . t('language field') . ')';
    }
  }
}