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

Form constructor for the book outline form.

Allows handling of all book outline operations via the outline tab.

Parameters

Node $node: The book node for which to show the outline.

See also

book_outline_form_submit()

book_remove_button_submit()

Related topics

File

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

Code

function book_outline_form($form, &$form_state, Node $node) {
  if (!isset($node->book)) {
    // The node is not part of any book yet - set default options.
    $node->book = _book_link_defaults($node->nid);
  }
  else {
    $node->book['original_bid'] = $node->book['bid'];
  }

  // Find the depth limit for the parent select.
  if (!isset($node->book['parent_depth_limit'])) {
    $node->book['parent_depth_limit'] = _book_parent_depth_limit($node->book);
  }
  $form['#node'] = $node;
  $form['#id'] = 'book-outline';
  _book_add_form_elements($form, $form_state, $node);

  $form['book']['#collapsible'] = FALSE;

  $form['update'] = array(
    '#type' => 'submit',
    '#value' => $node->book['original_bid'] ? t('Update book outline') : t('Add to book outline'),
    '#weight' => 15,
  );

  $form['remove'] = array(
    '#type' => 'submit',
    '#value' => t('Remove from book outline'),
    '#access' => _book_node_is_removable($node),
    '#weight' => 20,
    '#submit' => array('book_remove_button_submit'),
  );

  return $form;
}