function emimport_node in Embedded Media Field 5
this will create a new node based on the values given in $item and prepare it for saving.
Parameters
$form_values: this is returned when submitting the form
$field_name: this is the field we're using for title & body
1 call to emimport_node()
- eimport_process_info in contrib/
emimport/ emimport.module - this will prepare our node, save it, and give us a message
File
- contrib/
emimport/ emimport.module, line 510
Code
function emimport_node($info) {
//$form_values, $field_name, $item, $codes, $tags_vid, $type) {
$node = array();
$node = (object) $node;
$node->type = $info['#type'];
node_object_prepare($node);
$node_options = variable_get('node_options_' . $node->type, array(
'status',
'promote',
));
// If this is a new node, fill in the default values.
if (!isset($node->nid)) {
foreach (array(
'status',
'promote',
'sticky',
) as $key) {
$node->{$key} = in_array($key, $node_options);
}
$node->uid = $info['#account']->uid;
}
// Always use the default revision setting.
$node->revision = in_array('revision', $node_options);
$node->name = $info['#account']->name;
$node->title = $info['#title'];
$node->body = $info['#body'];
$node->{$info['#field_name']}[0]['embed'] = $info['#original_link'];
$node->{$info['#field_name']}[0]['value'] = $info['#code'];
$node->{$info['#field_name']}[0]['provider'] = $info['#provider'];
$node->taxonomy['tags'][$info['#tags_vid']] = $info['#tags'];
return node_submit($node);
}