You are here

function book_helper_action_form in Book helper 7

File

./book_helper.module, line 531
Improves Drupal's core book module's functionality.

Code

function book_helper_action_form($context) {
  $settings =& $context['settings'];
  $books = $settings['books'];
  $depth = $settings['depth'];
  $all_books = book_get_books();
  $options = array();
  foreach ($all_books as $book) {
    if (empty($books) || in_array($book['nid'], $books)) {
      $options += book_toc($book['nid'], $depth);
    }
  }
  if (empty($options)) {
    drupal_set_message(t('You have no books.'), 'error');
    return array();
  }
  $form['book'] = array(
    '#type' => 'select',
    '#title' => t('Choose a parent book page'),
    '#options' => $options,
    '#description' => t('Select the parent book page you wish to move the book page into'),
  );
  return $form;
}