Community Documentation

BookMadeSimple - Simplify book use.

Last updated September 24, 2012. Created by MarcElbichon on July 2, 2009.
Edited by pjwalmsley, chaosmind, akalsey, ultrabutter. Log in to edit this page.

BookMadeSimple aims to bypass some lacks of the standard Book module and so, simplify book management.

The major features are :

  • Create automatically main book page for any content-type by checking option in content-type settings
  • Add links to book page to add any content-type as child of book. Childs content-type are defined in content-type settings

REMARK : Explanations below are for Drupal 6, but BookMadeSimple behaviours are the same for Drupal 5

Auto creation of main book page

With standard book module, to create a new book, you need to create a node, go to Book Outline section and choose Create an new book.
With BookMadeSimple, you only need to define in BookMadeSimple settings or content-type settings, content-types to automatically create as book

Add child page list

With standard book module, to add a child page, you need to click to "Add child page link". So you can only add book page as child. To add another content-type as child, you need to create a new content and select parent book page in book outline section. Not very user friendly.

BookMadeSimple adds a list at bottom of page to directly add a content-type as child of the book. This list can be defined as a global way in BookMadeSimple settings or by content-type in content-type settings.
The list can be :

  • A dropdown list box (default)
  • An unordered list (standard drupal links)
  • Anything you want by themeable function

Permissions

BMS manage two user permissions :

  • show core Outline links : By default, standard outline links (outline tab, fieldset and reorder tab) are hidden. You can show them by role.
  • show book reorder link : You can also show only reorder tab by role.

Tips

  1. You can hide default "Add child page" link by checking "Hide default add child link" checkbox in BookMadeSimple settings.
  2. To place dropdown listbox top of links, add these lines to your template.php file :

    <?php
    function <your template>_links($links, $attributes = array('class' => 'links')) {
             if (
    array_key_exists("book_made_simple",$links)) {
                   
    $a = $links["book_made_simple"];
                    unset(
    $links["book_made_simple"]);
                   
    array_unshift($links,$a);
             }
             return
    theme_links($links, $attributes = array('class' => 'links'));
    }
    ?>
  3. To theme the render of the child list, create a function _add_child_book_content_types(...) in your template.php like this :
    <?php
    /*
    Args :
        $allowedTypes : Associative array (content-type => name) of allowed child for the content type. Caution, before 2.2, you must convert underscore to hyphens for links.
        $node : node object.
    Return : HTML code to display
    */
    function <your_template>_add_child_book_content_types($allowedTypes, $node) {
         
    $html = "";
          foreach (
    $allowedTypes as $type => $name ) {
           
    // str_replace needed for version prior to 2.2
           
    $html .= l($name, 'node/add/' . str_replace('_', '-',$type));
        }   
         return
    $html;
    }
    ?>

Page status

No known problems

Log in to edit this page

About this page

Drupal version
Drupal 5.x, Drupal 6.x, Drupal 7.x
Audience
Site administrators, Site users
Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.