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
- compatible with spaces 2.0-x
- integrates with cck, context, ctools, imagecache, views.
Drush integration
While Features provides a Drupal UI for building and managing features, developers will quickly find benefit from several useful drush commands:
featuresList 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.*.incTo 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
- Read the contributed documentation here on drupal.org
- Want to learn how features fits into the overall packaging and deployment picture in Drupal? http://groups.drupal.org/packaging-deployment
- Screencast Making and Using Features in Drupal @ the DevSeed blog
