Features Module

From http://drupal.org/project/features

The features module enables the capture and management of features in Drupal. A feature is a collection of Drupal entities which taken together satisfy a certain use-case.

Features provides a UI and API for taking different site building components from modules with exportables and bundling them together in a single feature module. A feature module is like any other Drupal module except that it declares its components (e.g. views, contexts, CCK fields, etc.) in its .info file so that it can be checked, updated, or reverted programmatically.

Compatibility

1.0-x branch of Features

Drush integration

While Features provides a Drupal UI for building and managing features, developers will quickly find benefit from several useful drush commands:

  • features List all available features for your site.
  • features export [context identifier] Export a feature and all its components starting from a context.
  • features update [feature name] Update a feature module's code definitions from any overrides in the database.
  • features revert [feature name] Revert any components that have overrides in the database back to their default state.

Adding to your feature and including custom code

Once you've exported your feature you will see that you have several files:

 

myfeature.info
myfeature.module
myfeature.defaults.inc
myfeature.features.inc
myfeature.features.*.inc

 

To add a component to your feature, simply add your myfeature.info file and add an entry for the component you would like to add. Then run drush features update myfeature or use the UI to update your code.

You can also add custom code (e.g. custom hook implementations, other functionality, etc.) to your feature in myfeature.module as you would with any other module. Do not change or add to any of the defaults or features inc files unless you know what you are doing. These files are written to by features on updates so any custom changes may be overwritten.

Documentation

Documentation for getting started with Features can be found on http://drupal.org/node/580026.

Contributors: Clemens Tolboom, Itangalo

Learn more