You are here

function book_outline_form in Drupal 6

Same name and namespace in other branches
  1. 7 modules/book/book.pages.inc \book_outline_form()

Build the form to handle all book outline operations via the outline tab.

See also

book_outline_form_submit()

book_remove_button_submit()

Related topics

1 string reference to 'book_outline_form'
book_outline in modules/book/book.pages.inc
Menu callback; show the outline form for a single node.

File

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

Code

function book_outline_form(&$form_state, $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, $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' => $node->nid != $node->book['bid'] && $node->book['bid'],
    '#weight' => 20,
    '#submit' => array(
      'book_remove_button_submit',
    ),
  );
  return $form;
}