function feedapi_simplified_form_submit in FeedAPI 6
Same name and namespace in other branches
- 5 feedapi.module \feedapi_simplified_form_submit()
Create the node object and save
File
- ./
feedapi.module, line 796 - Handle the submodules (for feed and item processing) Provide a basic management of feeds
Code
function feedapi_simplified_form_submit($form, &$form_state) {
$node_template = (object) $form_state['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_state['values']['url'])) {
drupal_set_message(t('Feed successfully created.'));
$form_state['redirect'] = 'node/' . $node->nid;
}
else {
drupal_set_message(t('Could not retrieve title from feed.'), 'error');
$form_state['redirect'] = array(
'node/add/' . $node_template->type,
'feedapi_url=' . urlencode($form_state['values']['url']),
);
}
}