You are here

function emfield_feeds_node_processor_targets_alter in Feeds 7

Same name and namespace in other branches
  1. 6 mappers/emfield.inc \emfield_feeds_node_processor_targets_alter()

Implements hook_feeds_node_processor_targets_alter().

See also

FeedsNodeProcessor::getMappingTargets().

File

mappers/emfield.inc, line 14
On behalf implementation of Feeds mapping API for emfield.module (Embedded Media Field).

Code

function emfield_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(
        'emvideo',
        'emaudio',
        'emimage',
      ))) {
        $fields[$field_name] = isset($field['widget']['label']) ? $field['widget']['label'] : $field_name;
      }
    }
  }
  foreach ($fields as $k => $name) {
    $targets[$k] = array(
      'name' => $name,
      'callback' => 'emfield_feeds_set_target',
      'description' => t('The Embedded !name field of the node. Map a URL of a page containing media to this field.', array(
        '!name' => $name,
      )),
    );
  }
}