function feedapi_simplified_form_submit in FeedAPI 5
Same name and namespace in other branches
- 6 feedapi.module \feedapi_simplified_form_submit()
Create the node object and save
File
- ./
feedapi.module, line 743 - Handle the submodules (for feed and item processing) Provide a basic management of feeds
Code
function feedapi_simplified_form_submit($form_id, $form_values) {
$node_template = (object) $form_values['node'];
$feed_type = (string) $_POST['node']['type'];
$valid_types = array_keys(feedapi_get_types());
foreach ($valid_types as $type) {
if ($type === $feed_type) {
$node_template->type = $type;
}
}
if ($node = feedapi_create_node($node_template, $form_values['url'])) {
drupal_set_message(t('Feed successfully created.'));
return 'node/' . $node->nid;
}
else {
drupal_set_message(t('Could not retrieve title from feed.'), 'error');
return array(
'node/add/' . $node_template->type,
'feedapi_url=' . urlencode($form_values['url']),
);
}
}