$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' => 'content_feeds_set_target', 'description' => t('The CCK !name field of the node.', array('!name' => $name)), ); } } /** * Callback for mapping. Here is where the actual mapping happens. * * When the callback is invoked, $target contains the name of the field the * user has decided to map to and $value contains the value of the feed item * element the user has picked as a source. */ function emvideo_feeds_set_target($node, $target, $value) { $field = isset($node->$target) ? $node->$target : array(); // Handle multiple value fields. if (is_array($value)) { $i = 0; foreach ($value as $v) { if (!is_array($v) && !is_object($v)) { $field[$i]['embed'] = $v; } $i++; } } else { $field[0]['embed'] = $value; } emvideo_field('presave', $node, $field_name, $items, FALSE, FALSE); $node->$target = $field; }