function auto_nodetitle_node_form_submit in Automatic Nodetitles 6
Makes sure the node preview is shown right. It gets the node object, modifies the title, and updates the node in the form_state.
1 string reference to 'auto_nodetitle_node_form_submit'
- auto_nodetitle_form_alter in ./
auto_nodetitle.module - Implementation of hook_form_alter().
File
- ./
auto_nodetitle.module, line 48 - Allows hiding of the node title field and automatic title creation
Code
function auto_nodetitle_node_form_submit($form, &$form_state) {
// Only do something, if the user clicked the preview button.
if (isset($form_state['clicked_button']['#submit']) && in_array('node_form_build_preview', $form_state['clicked_button']['#submit'])) {
$setting = auto_nodetitle_get_setting($form_state['values']['type']);
if ($setting == AUTO_NODETITLE_ENABLED || $setting == AUTO_NODETITLE_OPTIONAL && empty($form_state['values']['title'])) {
$node = node_submit($form_state['values']);
auto_nodetitle_set_title($node);
$form_state['values'] = (array) $node;
}
}
}