By the time most large Drupal sites have been around for a year or two, they've accumulated a menagerie of content types. Articles, press releases, product pages, reviews, biographies, landing pages, home pages, promo rotators, photo galleries, and more litter the list of content, and making sure they're treated consistently can be a problem.

A view that was created last year, for example, might have displayed just the right list of content types then, but who's making sure the new stuff gets handled properly? The Content Type Groups module can simplify that problem: it lets administrators define groups of content types for organizational purposes.

Picture of the Content Type Groups admin screen

Once installed, the module adds a new administration page to Drupal's Structure section. Admins can define new Groups and assign content types to them -- they're not exclusive, so one content type can belong to multiple groups if it makes sense. The most important impact of these groups felt when building Views. If you're adding content type filters (or contextual filters) to a listing page, you can use a Content Type Group filter instead. Building a view that lists "All news content types" or "All user-created content types" rather than specifying each type individually makes it easier to ensure that future changes and additions will ripple through to previously-created views.

Picture of the Content Type Groups views filter page

While the concept is simple, the module's execution is perfect. The admin screens are self-explanitory and easy to use, the Views integration works nicely, and the content type groups can be exported as part of a Feature module. In the future, it would be great to leverage group information to organize the often-overwhelming "Add New Node" overview page. For now, though, Content Type Groups is a great tool for future-proofing Views and documenting the intended purpose of a site's varied content types.

If you enjoyed this Article, you may also enjoy...

Jeff Eaton

Thumbnail
Jeff Eaton is world renowned for his opinions on Content Strategy, Drupal development, bacon, gummy candy, and cats.