You are here

function auto_nodetitle_node_submit in Automatic Nodetitles 8

Same name and namespace in other branches
  1. 7 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 53
Allows hiding of the node title field and automatic title creation.

Code

function auto_nodetitle_node_submit(NodeInterface $node, $form, &$form_state) {
  $setting = auto_nodetitle_get_setting($node
    ->getType());
  if ($setting == AUTO_NODETITLE_ENABLED || $setting == AUTO_NODETITLE_OPTIONAL && empty($form_state['values']['title'])) {
    auto_nodetitle_set_title($node);
  }
}