Fork me on GitHub

robknight.org.uk

Latest project, and why the Features module for Drupal is awesome

Posted on 14 November 2009 - 12:31pm

At PRWD we've just completed our latest project, a website for the new public policy think-tank ResPublica. The site was built using Drupal, and you can read the drupal.org case study here.

This has been the first full Drupal site I've delivered for a while, and I've been getting to grips with some of the great new contributed modules that have appeared recently. In particular, the Features module has been a revelation - what it does is incredibly simple and yet also incredibly powerful. It's something that I can't imagine not using on every project.

The Features module solves one of the biggest problems with Drupal development and deployment: the fact that lots of structural information - in particular, content types, views and imagecache presets - gets stored in the database. To deploy a site from development to staging and then to live can involve either A) duplicating (in part) the database or B) manually exporting each view, content type etc. each time they are altered, and importing them into the relevant sites. There's no version control and mistakes are very easy to make.

Features solves all of this by packaging your stuff into a module. This automatically-generated module contains definitions of your views, content types etc., ready for installation on another site. So you might create a view on your development site, add it to a Feature, then just install that Feature on the staging server. Voila! Your view appears on the staging site. What's more, your Feature module can be kept under source code control, enabling you to manage it in precisely the same way that you would manage custom modules you've created yourself. If you change the view on your development server, just update your Feature module, check it in to your version control system, and check it out again on the staging server and you instantly get your new view.

This is a massive step forward for professional Drupal development. Once again I'm in awe of how great the Drupal community is at solving each other's problems. The fact that I'm able to take advantage of the fantastic work of other people - and hopefully I'll be contributing something back - is a testament to the power of open source and, in particular, the Drupal project. There's a post that I want to write at some point investigating why certain projects - the Linux kernel, Apache web server, Rails and of course Drupal - seem to hit that sweet spot of community engagement where the efforts of all of the people involved combine well to create something truly useful. Why do these projects succeed and others with similar aims and ambitions fail? For now, the only thing worth mentioning is that Drupal is definitely a project that is succeeding, perhaps better than any other open source CMS or any other PHP development framework.