Skip to end of metadata
Go to start of metadata


In Drupal a lot of configuration, content definition, in fact almost everything is stored in the DB. This makes development team work quite difficult: how do you share the content type that you just created with the others? how do you deploy it on a staging or production server?

Features to the rescue

Features is a Drupal module that lets you package part of one site, one 'feature', in a module that you can then easily share with others or deploy on other sites. For example if you create a content type with multiple fields, you can easily create a new feature, select the content type you want to export and save it. This will create a new module with your content type definition. Another developer can add this module as any other and activate it. Easy? yes!
By now you can add many drupal things in a features:

  • Custom blocks
  • Block settings (region, ...)
  • Drupal configuration variables (like site name, ...)
  • Internationalized configuration variables (like site name in Spanish or French)
  • Content types
  • Fields
  • Fieldgroups
  • Text/input formats
  • Image styles
  • Menus
  • Menu items
  • Taxonomies
  • Permissions
  • Roles
  • Wysiwyg profiles
  • ...

Update your features

Once a feature is imported (its module is activated) any change to its content will mark the feature as 'overridden'. (Internally features does a diff between what you have in your module files and what would the feature be if exported). You can then recreate your feature by exporting it again.

Drush loves features

Drush is a shell utility that eases your life with Drupal. Bored of all these clicks? Let Drush help you! Even better: Features is well integrated into Drush and let you do everything via commands:

  • $ drush features to list all existing features and their state
  • $ drush fd <my_feature> (features-diff) to show the diff between the actual state of the feature and the code state
  • $ drush fe <my_feature> (features-export) to export a feature to a module
  • $ drush fr <my_feature> (features-revert) to revert/import a feature from the module code to the DB
  • $ drush fu <my_feature> (features-update) opposite as features-revert: updates the exported feature from the DB to the module code
  • ...
    so when you updated your feature and pushed it to your vcs, all your coworkers have to do is
    $ drush fra to make sure the features latest versions are applied to the website.

Extend features

Features is already available for a lot of stuff but you can also easily make new stuff featurable. For example we made wysiwyg settings featurable and variables as well. To create it we had a look at the features module itself and saw that we just had to understand a few concepts and implement a few methods on the features API.


Not everythink is pink of course... we had some bad issues with Strongarm which broke the i18n part of our site. We decided to remove it and create our own feature to export/import core variable.
We also fought a lot against Drupal cache. I would say that this is the key when working with features: whenever something seems weird clear your cache! Better, make sure your extension of features clears the cache at the right time.


Features for Drupal 7 was a great help for our project and eased a lot some crucial stuff like work progress sharing. Hope it will help you too!

Further Reading


  • None