function data_node_active_form_create_submit in Data 6
Create submit handler for form.
1 string reference to 'data_node_active_form_create_submit'
- data_node_active_form in data_node/
data_node.module - Form callback for setting the active node.
File
- data_node/
data_node.module, line 197 - Hooks and API functions for Data Node module.
Code
function data_node_active_form_create_submit($form, &$form_state) {
$title = trim($form_state['values']['title']);
if (!empty($title)) {
global $user;
$node = new stdClass();
$node->uid = $user->uid;
$node->title = $title;
$node->type = $form_state['values']['type'];
$node->body = '';
foreach (variable_get('node_options_' . $node->type, array(
'status',
)) as $key) {
$node->{$key} = 1;
}
node_save($node);
data_node_set_active($form['#table']
->get('name'), $node->nid);
}
// Redirect ourselves because '#redirect' does not support queries.
$query = array();
foreach ($_GET as $k => $v) {
if ($k != 'q') {
$query[] = "{$k}={$v}";
}
}
drupal_goto($_GET['q'], implode('&', $query));
}