function book_outline_form_submit

7.x book_outline_form_submit($form, &$form_state)

Form submission handler for book_outline_form().

See also



drupal/modules/book/, line 184
User page callbacks for the book module.


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']) {
    drupal_set_message(t('No changes were made'));


  $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.
      drupal_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 {
      drupal_set_message(t('The book outline has been updated.'));
  else {
    drupal_set_message(t('There was an error adding the post to the book.'), 'error');