Building features on Open Atrium
I mentioned features a couple of times before on this blog, but didn't have a good opportunity to take them out for a spin. But then Open Atrium was launched this summmer, and this Drupal intranet package makes extensive use of features, context and spaces. So I decided to take a closer look at Atrium - also because I was looking earlier into ways to use a Drupal setup as a collaboratice project management tool, like Basecamp.
My goal was to see how customizable Atrium is by using features and of course without touching any Atrium files to keep upgrading possible. As it turns out, this is perfectly possible and not that hard.
So, what are 'features'?
Features is a Drupal module which allows you to export certain functionality to code. For example, a combination of content-types, views, filters and imagecache presets. This screencast show this proces very well. The feature doesn't include the modules it depends upon, but does show all dependencies.
If you use Features, all that those differents configurations you need for a bundled piece of functionality (like an Image gallery) which are scattered all over the place in Drupal get bundled in nice little packages. And, last but not least, they are reusable on other Drupal sites.
The use of features becomes very clear once you start using it. However, if you really want to leverage its power, you should also understand two related modules Context and Spaces as these three work closely together. It can be pretty hard to grasp at first. The best way to understand how this al works is just by start playing around with it.
[caption id="attachment_1048" align="alignnone" width="574" caption="Adding an extra feature 'tab' to Open Atrium"][/caption]
Adding a custom feature to Atrium
For example by adding an extra feature 'tab' to Atrium. In fact, all other tabs in Atrium are such features, and you can easily see how they are configurated. Just don't forget to turn on the UI for context and spaces (which are turned of by default when you install Arium).
There is a tutorial available which explains setting it up accurately, even to the point howto replace the icon (in above screenshot the default question mark) with your own icon. Also, check out the features documentation on drupal.org.
Some important things to keep in mind: just adding modules to Atrium won't do the trick. You have to make Atrium 'aware' of them by building features. When you build a feature in Atrium, you need to associate it with one or more contexts. Then you use Spaces to activate those features in the site. The extra lines which you currently have to add in your features' .info file are because of the branch 2.0 changes to the Spaces module.
I mentioned features are reusable, just like modules, and therefore it's possible to share your features with others. Plans for distributed feature servers seem to be nearing completion, which will allow for public or private (within your organisation) servers to host features. This won't give you version control on your own server, but it all still sounds like A Very Good Idea to me.
- Check out this related video in case you missed the session about at Drupalcon Paris two weeks ago.