1.12.x book.pages.inc book_outline_form_submit($form, &$form_state)
1.10.x book.pages.inc book_outline_form_submit($form, &$form_state)
1.11.x book.pages.inc book_outline_form_submit($form, &$form_state)
1.7.x book.pages.inc book_outline_form_submit($form, &$form_state)
1.8.x book.pages.inc book_outline_form_submit($form, &$form_state)
1.9.x book.pages.inc book_outline_form_submit($form, &$form_state)

Form submission handler for book_outline_form().

See also

book_remove_button_submit()

File

modules/book/book.pages.inc, line 105
User page callbacks for the book module.

Code

function book_outline_form_submit($form, &$form_state) {
  $node = $form['#node'];
  $form_state['redirect'] = "node/" . $node->nid;
  $book_link = $form_state['values']['book'];
  if (!$book_link['bid']) {
    backdrop_set_message(t('No changes were made'));

    return;
  }

  $book_link['menu_name'] = book_menu_name($book_link['bid']);
  $node->book = $book_link;
  if (_book_update_outline($node)) {
    if ($node->book['parent_mismatch']) {
      // This will usually only happen when JS is disabled.
      backdrop_set_message(t('The post has been added to the selected book. You may now position it relative to other pages.'));
      $form_state['redirect'] = "node/" . $node->nid . "/outline";
    }
    else {
      backdrop_set_message(t('The book outline has been updated.'));
    }
  }
  else {
    backdrop_set_message(t('There was an error adding the post to the book.'), 'error');
  }
}