You are here

function bookblock_admin_settings in Book Block 6

Same name and namespace in other branches
  1. 7 bookblock.admin.inc \bookblock_admin_settings()

Builds and returns the bookblock settings form.

1 string reference to 'bookblock_admin_settings'
bookblock_menu in ./bookblock.module
Implementation of hook_menu().

File

./bookblock.admin.inc, line 14
Admin page callbacks for the booknavigationblocks module.

Code

function bookblock_admin_settings() {
  $books = book_get_books();
  $bookblock_books = variable_get('bookblock_books', array());
  if ($books) {
    foreach ($books as $book) {

      // Sanitize the title, as unsanitized data is returned bu book_get_books.
      $book['title'] = check_plain($book['title']);
      if (!$book['has_children']) {
        $book['title'] = $book['title'] . ' <em>(' . t('no child pages') . ')</em>';
      }
      if (in_array($book['nid'], $bookblock_books)) {
        $book['title'] = $book['title'] . ' ' . l('configure', 'admin/build/block/configure/bookblock/' . $book['nid']);
      }
      $books[$book['nid']] = $book['title'];
    }
    $form['bookblock_books'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Generate a navigation block for each of the following books'),
      '#default_value' => $bookblock_books,
      '#options' => $books,
      '#description' => t('For each book that you select, a separate navigation block will be created. You can enable these blocks on the blocks administration page or use the context module.'),
    );
    $form['array_filter'] = array(
      '#type' => 'value',
      '#value' => TRUE,
    );
    return system_settings_form($form);
  }
}