Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

A Deep Dive into Views in a Unique Fashion (Book Review: Mastering Drupal 8 Views)

Parent Feed: 

Mastering Drupal 8 Views book cover

Gregg Marshall's Mastering Drupal 8 Views is one of the (I can only assume) many Drupal 8-focused books that will be released in the coming months. It is a very good deep dive into many of the hidden corners of the Views module, albeit with an interesting format. Not completely structured like a typical how-to software book, Gregg takes a bit more of a novel approach (pun intended) - he takes the reader on a journey through the Views module through the eyes of Lynn, a small business owner (Lynn's cat and Drupal consultant also have prominent roles). While some readers might find the story-ish elements distracting, they add a certain degree of warmth to the book - something I can only assume a subset of readers will more than appreciate.

The author does a nice job of setting the stage, identifying the intended audience for the book, and speaking directly to them (through the book's characters). There are sections of the book that may cause confusion with this structure, on several occasions I found myself reading long, multi-paragraph sections that I didn't immediately realize that a character was speaking, and not the author. It seems that the use of quotations to indicate when characters were speaking was not consistently applied.

While the technical content of the book is often well-written and clear, there are some places in the book where things seem out-of-order - none more so than the first lesson diving into the Views "settings" page - something that most people new to the subject don't need to consider until they need to modify the (very sane) default values. Another example early in the book has the author creating a new view "display" prior to a full explanation of what Views display are.

There are, however, many areas of great explanation on topics that I don't recall ever seeing in other Drupal-related books. Sections on the new "entity reference" and "REST export" display types stood out in the first few chapters, as well as some of the best explanations (and details) on the "table" format, and field rewrites (more on this in a bit).

There are several lessons that have starting points that aren't necessarily considered "best practice", including one that has the reader cloning the admin/content view as a starting point for a public facing view. In my opinion, the reader would be better served by starting a brand new view using the Views "wizard" interface. As a stickler for best practices, there were several things in the book that made me cringe a bit, including the use of the (outdated?) GMap and Location modules (instead of Geofield-related modules) and (even more so) the use of the admin area's "Install new module" functionality.

I found the discussion and lessons around contextual filters to be extremely effective. The story-ish nature of the book allowed the author to almost naturally introduce a problem that is elegantly solved with contextual filters. Along with relationships, contextual filters are often one of the major stumbling blocks in learning Views, and this book does as good a job as anything else I've read and taking the reader down in the deep, dark recesses of it ("Default value" options included!) The chapter on Views relationships is similarly structured and just as effective.

This is perhaps one of the only Drupal books I've read that purposely sends the reader (in this case, the main character as well) down a dead-end in order to introduce a new topic. I think that many readers will find this comforting, in that it allows the author to introduce a new topic in order to direct the reader to a solution.

As a big fan of display modes, combined with the fact that they are much more visible in Drupal 8, I hoped that the author would utilize them more often in the various lessons (instead of relying on adding fields to most views).

The book really shines in chapters that normally are only a small section in other Drupal resources. There is an entire chapter on field rewrites, and it is wonderful. The author takes Lynn and the reader through various examples, each exposing a new aspect of field rewrites. For anyone who doesn't dare dive into this section of Views field configuration, this chapter alone is worth the price of the book.

The chapter on all the settings in the "Advanced" fieldset is also something that the author covers extremely well. In most Views references, many of these settings are glossed over, but this book provides an almost ("aggregation" isn't covered as deeply as I hoped) complete reference to all the various available settings.

While the vast majority of the examples in the book are well structured, many of them depend on content types and other information architecture that exists on "Lynn's" site. While details of the information architecture are provided in an appendix, it would be very helpful for the author to provide them via GitHub or some other electronic mechanism to readers. Otherwise, it seems like a tedious and error-prone process for readers to recreate the information architecture on their own in order to follow the examples in the book.

The author does a nice job of walking the reader through the use of several Views-related contributed modules as well. For my taste, I think there should have been just a little more explanation about how various contributed modules fit together with Views. As an example, the fact that Views Slideshow provides a new display plugin is glossed over. I think it would serve the readers well to specifically mention that many Views related modules are simply plugins for various parts of the Views infrastructure. This would provide readers with a higher-level view of the Views ecosystem. That's a bit of a nitpick though, as this section is really, really solid.

One of the last chapters in the book covers theming views, and I think it doesn't go into enough details and/or examples. The section on adding CSS classes to various parts of a view is very useful, but the section on overriding template files feels incomplete.

Overall, this is a welcome addition to the Drupal family of books, and one that I can honestly recommend for users that feel like there are aspects of the Views module that are still a mystery to them. The novel-like structure of the book normally doesn't get in the way of the lesson, but for readers who normally don't read technical books front-to-back (instead cherry picking only chapters of interest), it might be a bit distracting. While this is properly identified as a Drupal 8 book, much of the content is also valid for Drupal 7, including some of (in my opinion) the strongest chapters.

Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web