BookMadeSimple – Simplify book use.
BookMadeSimple – Simplify book use.
Source : http://drupal.org

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 : Explinations below are for Drupal 6, but BookMadeSimple behaviours are the sames 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 really user friendly, isn't it ? So, use BookMadeSimple
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;
    }
    ?>

Leave a Reply

Your email address will not be published. Required fields are marked *