function sheetnode_text_import_form_submit in Sheetnode 7.2
Same name and namespace in other branches
- 6 modules/sheetnode_text/sheetnode_text.module \sheetnode_text_import_form_submit()
- 7 modules/sheetnode_text/sheetnode_text.module \sheetnode_text_import_form_submit()
Submit handler for import form.
File
- modules/
sheetnode_text/ sheetnode_text.module, line 49 - Module file for the sheetnode_text module.
Code
function sheetnode_text_import_form_submit($form, &$form_state) {
module_load_include('inc', 'node', 'node.pages');
global $user;
$title = $form_state['values']['title'];
$text = $form_state['values']['text'];
$options = array(
'ignore_spans' => variable_get('sheetnode_text_ignore_spans', FALSE),
'process_dividers' => variable_get('sheetnode_text_process_dividers', TRUE),
);
$sc = sheetnode_text_import($text, $options);
$node = new StdClass();
$node->type = 'sheetnode';
node_object_prepare($node);
$node->title = $title;
$node->name = $user->name;
$node->language = LANGUAGE_NONE;
$node->sheetnode['value'] = $sc;
$node->sheetnode['template'] = NULL;
$context = array(
'text' => $text,
'options' => $options,
);
$params = array();
drupal_alter('sheetnode_import', $node, $params, $context);
// Save the sheetnode.
$node = node_submit($node);
node_save($node);
if (!empty($node->nid)) {
$form_state['redirect'] = 'node/' . $node->nid;
}
}