Typically I find that learning by doing works best for me, and there are some subjects (Drupal) that lend themselves to this approach as well. Drupal 7 Development by Example sounded like just the ticket. Many of the big keywords are hit on while flipping through the preface. Initially this sounds great, but perhaps there are too many? This book appears to have all the right intentions, but maybe it bites off a bit too much?
Who this book is for
This book is for people who have some experience building websites and who want to learn to do so with Drupal 7. You should have experience with HTML markup, CSS, and jQuery. Experience with previous versions of Drupal would be helpful, but is not necessary.
Authored by Kurt Madel, the book was published in May 2012, about 2 months before I got it. It has roughly 340 pages of content, divided among 11 chapters. Glancing through the preface of what the book covers, the buz words flow: Module Development, HTML5, Theme Development, UX, Media, Views, SimpleTest and Features jump out. Additionally the preface covers some of the tools you will use: MAMP/XAMPP, GIT, Drush, Aptana Studio, Drupal core and a list of modules. The "Who this book is for" statement is also in there, I quote it for a reason. Also I would like to draw attention to the module list, which also lists the versions of the modules used, this is very important.
Just 2 months after the book is published many of the instructions no longer work. This is because the modules have changed. While the preface list shows the version, it would have been very helpful to list the version when instructed to install a module. Then it would be fresh in the readers head that the version was different and a good clue why things don't look as described. Drupal is constantly changing and it's modules some times change at break neck speed, documenting them in print is going to have problems. Kind of the nature of the beast.
Chapter 1 runs quickly through installing MAMP & XAMPP. I hate XAMMP, couldn't bring myself to do it (a subject for a future blog series). It does cover making a few tweaks for performance, so a few points there. Then onto installing Drush and Git, extra points for covering installing these on Windows. However when it came to installing Drupal I had to scratch my head. Drush is an awesome way to install Drupal,
drush dl drupal. The reader is instructed to use Git to clone the Drupal project, while this works, it comes with a lot of baggage. As in EVERY version of Drupal from version 3 to version 8 and every point, beta and dev in between. Downloading with Drush brings down just the current stable release, which is 11.2mb and 1050 files. Cloning with Git grabs 61.8mb and 3023 files. There is a comment about how the Git method can make upgrades easy, but it is never explored. The process of installing Drupal is stepped through, like I would expect from a book that says you don't need experience with a previous version of Drupal, except the steps for copying
settings.php and creating
sites/$new_url/files are skipped. The chapter finishes out with Installing Aptana Studio and a quick introduction to Drupal.org. I had hoped some of the developer related features of using a full IDE would have been explored, however it turns out everything can easily be accomplished with Sublime Text 2, or even notepad.
Chapter 2 dives into Drupal with a new content type, and a lot of emphasis on schema.org. While interesting, it felt like we were losing focus and the schemas can get a little tedious, specially when they don't really relate specifically to Drupal. There is a discussion between, Core, Contrib and Custom modules. The
t() function gets introduced, but kind of passed right by. This function is kind of a big deal in Drupal and probably should have got more attention. Some code gets thrown out there with instructions to modify some existing code, which is hard to follow. When instructed on creating our first module, the opening
<?php tag is omitted from the instructions. The chapter wraps up by installing Views, building a simple block, and using Devel Generate.
Chapter 3 starts with a little HTML5 and microdata. I ran into some trouble with microdata, the descriptions didn't match with what I was seeing and then I started getting errors when the Microdata module was enabled. A new module is created for using a compound field. I had a lot of trouble with the code, and despite grabbing the example code from the website, the images stopped displaying.
Chapter 4 moves into themes, highlighting the Omega theme. Drush is used to create a base theme, but most all of the goodies in Omega are skipped over. Render Arrays get some attention and a decent first look. However the code used with
hook_preprocess_node is kind of glossed over. For example twice the pages are used setting up Omega, as are used on the Render Array and the preprocess function. While Omega is a great subtheme, it didn't really add anything to the section.
Chapter 6 brings in the Media module and some major moving target issues. Additionally around this time my site melted down, Ajax errors every time I tried to add an image. Disabling all the custom modules didn't help. So to keep going I turned to Aegir and fired up a new site ( I love Aegir ). I pulled in all the example code from the website to get things back in sync, which is when I realized the sample code had some minor errors relating to CSS classes that needed fixing. There were a few minor errors in instructions and then I ran into a wall. We are instructed to use the 2.x branch of the Media module, which has some nice improvements over 1.x, but is under heavy development. The version is actually labeled 'unstable'. A lot had changed from when this chapter was wrote and now. Luckily Dave Reid, a Media module maintainer, was able to straighten me out in IRC. He pointed me to a Media 2.0 tutorial that explained how to set things up, drupal.org/node/1699054. Dave also expressed some concern about using the unstable version of Media in a book, it is just changing to fast right now. The Colorbox module is also introduced and has changed since the book was published.
Chapter 7 deals with various ways to get feedback. It starts with the core contact form and Webform. There is a nice exercise on adding some text to the core contact form. This is a great example of a beginner exercise, and functionality that should be in core! The Devel module is used to dig some info out of Webform so the HTML5
Chapter 8 is more about Views. Mostly basic Views stuff, but there is an example of creating a Views plugin. Although mine didn't look anything like the screen shot, even when using the sample code. The module list says Views 3.3, and the current version is 3.5, so not all the buttons and items are labeled the same. I was still able to follow along, but it was annoying at times. The chapter ends with promoting the Colorbox custom module to a full project and using the Coder module. Good stuff, but has nothing to do with the Views chapter it lives in.
Chapter 9 lets you know right off the bat that the content isn't all related, "Rotating Banners and Project Promotion". The banner part uses Views Slideshow and some custom CSS to tweak the display, good beginner stuff. Then it is back to our custom Colorbox module to prepare it for submitting as a full project. Not so much for beginners, although something to aspire to I suppose.
Chapter 10 is SimpleTest, which I have to say flew right over my head and think most beginners will be totally baffled by as well. While the SimpleTest module is in Drupal core, it really is a PHP framework.
Chapter 11 hits on Features, which probably should have come much sooner in my opinion. This is actually a pretty good run down on features. Bonus points. Features is just the kind of thing that new developers should be learning, and can be tricky to understand at first.
There are multiple times when steps are skipped in the instructions. There are no photos in the downloads, which may sound petty, except the instructions sound like we should have them. This book suffers from editing issues. I fully understand that things change from the time a book is started till released, but many errors would have been found by just running through the examples like a clueless newbie.
It may sound like I hated the book, I don't. However going back to that Who this book is for statement, it misses the beginner mark. In fact if PHP were in that statement, half my issues would go away.
Not all is lost
It is quite obvious that Kurt Madel knows Drupal development. I would say this is probably a decent intermediate book, that has some editing issues.