Book review: Learning Drupal 6 Module Development

Learning Drupal 6 Module Development by Matt Butcher is a useful counterpart to Pro Drupal Development (PDD) in two ways -- it updates some of the content in PDD (which covers Drupal 5.x) and it focuses on some topics not covered in sufficient detail in the earlier, and intentionally more general, book, such as AJAX/JSON, in-module theming, and installation profiles. (Note: Pro Drupal Development is being updated to cover Drupal 6.) Like PDD, Learning Drupal 6 Module Development takes us through a number of hands-on examples while explaining how to implement the various Drupal APIs and subsystems, and also like PDD, this book helps make sense of the rich but sometimes difficult-to-use developer documentation available online at drupal.org and api.drupal.org.

The freely available sample chapter, Creating Our First Module, is typical of the rest of the book: clearly written with lots of concrete examples and useful callouts introducing related topics or pointers to further information. As noted above, some of the book's strong points include its coverage of theming, AJAX, and installation profiles. Coverage of how modules implement Drupal 6's new theming system is very strong, providing comprehensive information on topics such as registering theming functions, using external templates, and making it easy for theme designers to override a module's theming functions. Theming was pretty much totally rewritten in Drupal 6 and Butcher does an excellent job of explaining and illustrating how the new theming subsystem in general works, not just how it is used within modules.

Installation profiles, which allow automated configuration of modules, content types, themes, and actions for specific types of Drupal sites, are richer in Drupal 6 and than in Drupal 5, and Butcher documents the new capabilities thoroughly in the book's final chapter. Another subsystem that is improved in Drupal 6 and that Learning Drupal 6 Module Development covers in detail is sending email. Butcher very sensibly discusses the mail API in a chapter structured around building an administrative module for a Drupal site, which also covers the forms API and integrating mail with user profiles.

Finally, Learning Drupal 6 Module Development provides much needed documentation on Drupal 6's actions, which are events that are configured to take place based on some other event (like emailing a site's users when new content is posted). The chapter covering actions, plus the ones on theming and AJAX, are worth the price of the book, since they provide clear, complete coverage of two topics that are not explained succinctly and clearly in many other places.

Some things to watch for in Learning Drupal 6 Module Development:

  • Security is addressed throughout in the form of explanations of when to use Drupal's functions for preventing XSS and other web-based vulnerabilities, but Drupal's access control subsystem is covered only in three short paragraphs and one brief example implementation. In addition, the all-important db_rewrite_sql(), which allows modules to expose database queries that produce lists of nodes based on access rules, is not mentioned anywhere.
  • Strangely, the book's coverage of the ubiquitous database API, which gets an entire chapter in Pro Drupal Development, is noticeably shallow. Butcher does cover the new (to Drupal 6) schema API fairly well in the context of a module's installation script (which is where it is sensible to cover it), and even though Drupal's database API is purposefully simple, it seems strange that a book on module development should not contain more detailed coverage of such an important API.
  • CCK (the Content Creation Kit) and in particular Views are mentioned only in passing. This type of book is incomplete if it doesn't contain examples of how to incorporate these two modules into your own modules. While it is true that Views for Drupal 6 has not yet been released, it and its extension modules are among the most popular with Drupal implementors. As Butcher points out, CCK and Views are likely candidates for inclusion in Drupal 7, but views in particular offers a rich API designed specifically so that module developers can leverage Views' content querying capabilities. This gap seems glaring when core APIs such as those for mail and actions get such thorough treatment.
  • Learning Drupal 6 Module Development's back-of-the-book index is much less detailed than the one in Pro Drupal Development, but contains so few cross references that users of the ebook version will hardly notice.

As with Pro Drupal Development, which was the first book aimed specifically at Drupal module developers, Learning Drupal 6 Module Development should be on every Drupal hacker's bookshelf and laptop. It's really encouraging to see more examples of this type of book, since they make developing for such a rich content management framework as Drupal that much easier and more efficient. It's also encouraging to see another Drupal book of this quality and usefulness.

(PACT Publishers donates a portion of revenues generated by sales this book to the Drupal Association.)

Comments

Book review

CCK (the Content Creation Kit) and in particular Views are mentioned only in passing. This type of book is incomplete if it doesn't contain examples of how to incorporate these two modules into your own modules.

I just ordered the book and really look forward to going through it.

I agree with your above statement, hopefully someone is working on a book just for CCK/Views. I'll bet it would be very well received.. :)

Views and CCK... the reason they are not covered.

When the book was written, neither CCK nor Views 2 were past Alpha stage. By the time it was published, CCK was in RC. Views 2 was just entering beta.

In hindsight, I'm glad I didn't try to cover Views, as its API went through two more major epicycles before the final release landed. I would still be dealing with angry email submissions....

I'm really excited about the new database layer in D7, and you can rest assured that it will get MAJOR coverage in the D7 update of the book.

D7 db layer would be great

Matt, coverage of the new db layer would be great.

Very nice work on the book -- I know keeping your writing/publication schedule in sync with D6 ports of the major modules must have been a PITA.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <h3> <h4> <h5> <h6> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Use [toc list: ol; title: Table of Contents; minlevel: 2; maxlevel: 3; attachments: yes;] to insert a mediawiki style collapsible table of contents. All the arguments are optional.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
                   __     __         ____      _    
___ __ __ \ \ / / ____ / ___| / \
/ _ \ \ \ /\ / / \ \ / / |_ / | | / _ \
| __/ \ V V / \ V / / / | |___ / ___ \
\___| \_/\_/ \_/ /___| \____| /_/ \_\
Enter the code depicted in ASCII art style.