You are here

function auto_nodetitle_node_submit in Automatic Nodetitles 7

Same name and namespace in other branches
  1. 8 auto_nodetitle.module \auto_nodetitle_node_submit()

Implements hook_node_submit().

Generate the node title as soon as the form has been submitted. That way the node preview is shown right too.

File

./auto_nodetitle.module, line 77
Allows hiding of the node title field and automatic title creation.

Code

function auto_nodetitle_node_submit($node, $form, &$form_state) {
  $setting = auto_nodetitle_get_setting($node->type);
  if ($setting == AUTO_NODETITLE_ENABLED || $setting == AUTO_NODETITLE_OPTIONAL && empty($form_state['values']['title'])) {
    $node->auto_nodetitle_applied = TRUE;
    drupal_register_shutdown_function('_auto_nodetitle_save_title');
  }
}