IMO, features has been the missing component to Drupal for a long time. Ever since Drupal stored configuration, specific to your project in the database. That makes moving a change in you project from development to staging and to production rather complex and time consuming. While modules like Views and CCK implemented there own exporting techniques, really, the entire Drupal community needed to implement an exportable facet to the modules they offer. Features is quickly providing that facet. With features, out of the box, you can export custom views, content types, imagecache presets, permissions, panels and with strongarm and ctools, variables from the variables table. Here is a how to guide to using features as a Drupal site developer.

1. Download and install Features module.

This is a pretty straight forward task. Go to http://drupal.org/project/features and download the latest version of features, at this stage it is only supported on Drupal 6 with no backport to Drupal 5. Alternately, if you use Drush, use 'drush dl features'. Install features as you would any other module. 

You should get a Features menu option under site building in the admin section of Drupal. 

 

2. Create a feature

Click on the 'Create feature' tab. Here is where you can compile components together to make up your feature. Give your feature a name, description and version  like you would a module. After all, a feature is a module.

In the second fieldset is where all the magic is. Click on the select box and select a component you want to export, for example, content types. This will provide you with a list of checkboxes. You can add one or many content types as you like to your feature. 

As you add components to your feature, you should notice the exportables being listed on the right hand side showing you everything you that your feature will include.

Finally, once your happy with everything your going to export. Click the 'Download feature' button and features will wrap it all up for you into a tarball and prompt you to download it via the browser.

3. Enable the Feature.

There are two ways you can do this; through the features admin interface, or the modules page because a feature is a module. Untar the downloaded feature in your modules directory and enable it which ever way you want. I'm not sure of this, but I find its better to use the modules page because features doesn't enable dependencies (Well in drush it doesn't!). 

Now you'll see your feature in the feature admin page in a 'default' state.

4. The Features Admin interface.

Out of the box, the features admin page doesn't show much other than a test you can turn on if you have simpletests enabled. But as you create more and more features, they will appear here and you will be able to see the status of them. Status? yup thats right, a feature has a state. Features can be either in a default, overridden or needs review state. Default state is when the config in the database generates the identical code in the feature. An overridden state is when the config in the database differs to the config defined by the code in the feature. This occurs in two situations:

4.1 New database config 

You've exported a view into a feature and enabled the feature. You then change that view. That change is stored in the database so now the database and the code have different definitions of what that View is suppose to be. In this situation, the change you made you most likely want it to be apart of the feature, in which case, you will re-export the feature to set the feature back to its default state.

4.2 New code config

You've just deployed a new code base to your production enviroment. Maybe just uploaded the feature up via FTP. Now features tells you the feature is overridden. This is because you have some new config in your code that you need to push to production. This is when you click on the overridden state and revert it back to its original state.

Sometimes the cache needs to be cleared so features can re-determine the state of the feature.

5. Module development within your feature.

I think this is the most coolest part about features, not only can you re-export your feature, updating the database based config into code each time, you can also write code in the .module file! You can implement and addtional hooks your feature is missing. No need to write a custom module with out features anymore. All you need to do is start treating your feature like a normal custom module. Edit it as you please, and when you export it again, all your code will be exported with it!

Questions?