Drupal 7 Module Development

Drupal 7 Module Development

Drupal 7 Module Development

This book takes a hands-on, practical approach to software development. The authors, all professional Drupal developers and contributors to the Drupal project, provide accessible coding samples designed to exhibit not only the technical merits and abilities of Drupal, but also proper architectural and stylistic approaches to coding on one of the world’s most popular content management systems. Every chapter provides fully functional code samples illustrating the APIs and strategies discussed in

List Price: $ 44.99

Price: $ 36.49

[wprebay kw=”web+development+tutorial” num=”0″ ebcat=”-1″] [wprebay kw=”web+development+tutorial” num=”1″ ebcat=”-1″]


Posted

in

by

Comments

3 responses to “Drupal 7 Module Development”

  1. Owen Barrett Avatar
    Owen Barrett
    14 of 14 people found the following review helpful
    3.0 out of 5 stars
    Objectively poor, relatively good, July 29, 2011
    By 
    Owen Barrett (Irvington, NY, US) –

    This review is from: Drupal 7 Module Development (Paperback)
    Drupal documentation is severely lacking, on the whole. That’s why I thought I needed a book written by experts to pull the morass of Drupal documentation into a comprehensible structure. For the earlier chapters, the book did relatively well, providing D7-specific instruction on the Form API, entities, the Field API, and the theme layer, among others. However, as I wrap up my reading of the book with Chapter 10, on JavaScript in Drupal, I feel severely shortchanged. The example of AJAX used outside of a form using the ‘use-ajax’ class is essentially copied from […] sans comments and WITH ERRORS!!!! The API got it right, but this book didn’t! The errata for this book is a joke; I found multiple errors in the code whereas the errata seems only interested in minor grammar edits for the explanations. I’d much rather the code be right than the explanations’ grammar.

    Specifically, the error that I find particularly upsetting is the code snippet on page 308 that is also present in the hello_world.module sample code available to download from […].

    $page = array(‘#type’ => ‘ajax_commands’, ‘#ajax_commands’ => $commands);

    ^^ this is incorrect. The correct value for the ‘#type’ key, given by […], is ‘ajax’, not ‘ajax_commands’, and the correct second key isn’t ‘#ajax_commands’ it’s ‘#commands’. Once these corrections are made the code works; without them it doesn’t.

    The fact of the matter is that relative to the quality of other Drupal documentation, this book is great, so I still recommend it. It’s also possible that the API changed between this book being published and now.

    0

    Help other customers find the most helpful reviews 

    Was this review helpful to you? Yes
    No

  2. Nathan Smith Avatar
    Nathan Smith
    14 of 14 people found the following review helpful
    5.0 out of 5 stars
    A Must-Read for Serious Developers, March 26, 2011
    By 
    Nathan Smith (SonSpring.com) –
    (REAL NAME)
      

    This review is from: Drupal 7 Module Development (Paperback)

    While I consider myself well-versed at the front-end theme aspects of Drupal, I had been wanting to delve a little deeper into its underpinnings, if only to understand how modules work. Deconstructed, Drupal is essentially a series of modules working together — be that “core,” the bare CMS — or “contrib,” third party modules available for download from drupal.org. So, in an effort to bolster my skill set, I recently read Drupal 7 Module Development, from Packt Publishing and found it to be an excellent resource.

    If you have more than a passing interest in Drupal, then you are probably aware of the significance of such a talented group of developers collaborating on this book. The author list reads like a veritable who’s who in the subculture of Drupal…

    * Matt Butcher
    * Larry Garfield
    * John Wilkins – aka John Albin
    * Matt Farina
    * Ken Rickard
    * Greg Dunlap

    Matt Butcher works for the New York Times Company on their ConsumerSearch site. Greg Dunlap works for NodeOne, an agency in Sweden. The rest of the authors are heavy hitters at Palantir, a development firm based in Chicago.

    This book does not mince words, skipping past the whole installation process, because such information is readily available online anyway. What I like best about this book is that, after the requisite introductory chapter covering the broad strokes, it gets right into building a module from scratch, aptly named First, that outputs a list of all the currently installed modules. Chapter 2 also touches on code standards (covered here), as well as how to write automated unit tests.

    Chapter 3 is all about theming, and not just at a superficial stylistic level, but also how to make use of powerful preprocess functions, that allow the theme layer to edit Drupal’s output before it reaches the browser. I have implemented such techniques to make my own site HTML5, rather than the default XHTML 1.0.

    With module building and theming covered, chapter 4 jumps into how to theme a module, because modules themselves typically output a varying degree of markup themselves, and can (optionally) ship with CSS to handle any custom styling. Also covered is consideration for languages that read right to left, as internationalization has been a priority even since the earliest days of Drupal. Such cases should not be overlooked if you intend to make your module publicly available for reuse.

    Chapter 5 draws back the curtain a bit, so to speak, venturing into the administrative interface. Some modules do not actually affect a site’s public look and feel at all, but instead are built to facilitate a content creation workflow and/or user management. This chapter covers how to write an admin module that makes use of Drupal’s email API, sending the user a warning message if he or she is deemed to be in violation of the site’s terms of service.

    Chapters 6 and 7 cover how to work with custom content and field types, using artwork as an example of a special type of content (ch. 6), with the dimensions of each piece of artwork necessitating a custom field type (ch. 7). The authors are quick to point out that Drupal itself is versatile enough to handle such cases, without needing a custom module. However, they chose this as a faux case study, simply to explain building modules that handle custom content and fields.

    Chapters 8 and 9 cover permissions and security, as well as node access. One thing I have always appreciated about the community of developers around Drupal is the dedicated security team. Chapters 8 takes the same mindset, that any anonymous site visitors could potentially be nefarious, and explains the best ways to ensure that you are not leaving your site vulnerable due to exploit vectors in your module. Additionally, chapter 9 talks about conditionally showing content to various user tiers, depending on if they have the necessary credentials to view it.

    Chapter 10 is all about JavaScript, explaining that Drupal makes jQuery and jQuery UI available to you as a developer. For instance, via jQuery, Drupal automatically adds a draggable handle that makes any <textarea> resizable in all browsers, even those that don’t natively support it. When building your own modules, you can also tap into the convenience that jQuery affords. This chapter covers how to employ an Ajax approach to forms, rather than doing a full round trip to the server to refresh the entire page. It also touches on how to add translation via Drupal.t(), the JavaScript equivalent of Drupal’s PHP function t().

    In chapter 11, working with files and images is explained. Whereas previous versions of Drupal required an additional module to be installed in order to manipulate images, as of Drupal 7, this functionality is built into core. As a module developer, you can tap into the native Image API, allowing users to manipulate graphics via a web…

    Read more

    Help other customers find the most helpful reviews 

    Was this review helpful to you? Yes
    No

  3. eric a. Farris Avatar
    eric a. Farris
    14 of 14 people found the following review helpful
    5.0 out of 5 stars
    Well done by competent authors, January 20, 2011
    By 
    eric a. Farris (new creek, WV United States) –

    This review is from: Drupal 7 Module Development (Paperback)
    (Full disclosure: The publisher of this book sent me a review copy)

    This book will serve as a tremendously helpful introduction to Drupal programming for programmers. It does assume you know PHP, and warns you (or comforts you, depending) early on that there won’t be much OOP here and there will be a lot of structured arrays. The chapters don’t necessarily follow in order one to the next, and aren’t explicitly linked one with another.

    For programmers new to Drupal chapter one should be required reading. And while occasionally the book slips into “what’s new” mode, for the most part the reader is considered a competent PHP coder but not necessarily someone fluent in Drupal programming.

    The examples given throughout are mostly useful. One thing I hate about programming texts is when they show what the language/system can do with ridiculous examples. With the glaring exception of the Javascript chapter, this book does not stoop to such levels, instead giving real-world problems solved through the Drupal API.

    The style of the book is nicely conversational. The overt humor is sparse, but at the same time you don’t ever feel that you’re sitting in a lecture hall. The authors seem quite well-versed in the material and aren’t subjecting you to death-by-powerpoint-by-screenshot. They don’t talk down to you, ever, guiding the reader through the API as a comrade. Even in the areas of security and best practice, when it would be easy to slip into browbeat mode, they resist, presenting facts instead of opinion and advice rather than orders.

    The main problem I had with this book is that I feel there are parts missing. The book begins talking about how we’ll use modern techniques, and mentions Drush, the Drupal shell, one of my favorite tools. And that’s the last we’ll here of it. Seriously. Even when the installation profile chapter says we can use profiles at the command line, we end up writing a command line PHP script instead of leveraging Drush. An oversight in the editing, perhaps, to mention it at all?

    Also absent any real treatment is *contributing* rather than simply *developing*. A “10 minute git tutorial” appendix wouldn’t have been out of line. There’s no mention of how to be a good module maintainer, dealing with releases, submitting your module to drupal.org, or any such thing. While that’s not necessarily within scope, such a discussion is noticeable in its absence, particularly when the community is perhaps the strongest thing about Drupal. Given the status of the authors as top-tier contributors, it’s a curious omission.

    There are some nitpicks, some spelling errors, wrong screenshots, and discussions of things (ie., drush) that just aren’t there. No more, perhaps, than any other book of its size, and nothing that was too glaring or anything that would stop one in their tracks. We do occasionally slide away from coding standards (eg, after singing the praises of Doxygen comments earlier in the book, chapter seven contains no code comments at all), but it’s nothing too big.

    I was very happy to read through this book. It’s well written by competent authors. It gets me excited to write some custom code of my own for Drupal 7. While there’s not too much that will serve as a desk reference within the book (the authors are quick to point us to api.drupal.org, early and often), Drupal 7 Module Development is a worthy addition to the shelf and serves as a wonderful introduction to coding for Drupal.

    0

    Help other customers find the most helpful reviews 

    Was this review helpful to you? Yes
    No

Leave a Reply