You are here

function book_outline_form in Drupal 7

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

Form constructor for the book outline form.

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

Parameters

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

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: Shows the outline form for a single node.

File

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

Code

function book_outline_form($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, $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;
}