You are here

bookblock.admin.inc in Book Block 6

Same filename and directory in other branches
  1. 7 bookblock.admin.inc

Admin page callbacks for the booknavigationblocks module.

File

bookblock.admin.inc
View source
<?php

/**
 * @file
 * Admin page callbacks for the booknavigationblocks module.
 */

/**
 * Builds and returns the bookblock settings form.
 *
 * @ingroup forms
 */
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);
  }
}

Functions

Namesort descending Description
bookblock_admin_settings Builds and returns the bookblock settings form.