function book_outline_form_submit

Form submission handler for book_outline_form().

See also

book_remove_button_submit()

File

modules/book/book.pages.inc, line 184

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']) {
        drupal_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.
            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');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.