Pour toutes questions sur nos formations Drupal, n'hésitez pas à nous contacter.
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.
Examples of features might be:
Features is geared toward usage by developers and site builders. It is not intended to be used by the general audience of your Drupal site. Features provides tools for accomplishing two important tasks:
You can build features in Drupal by using site building tools that are supported (see a short list under the Compatibility section).
Once you've built and configured functionality on a site, you can export it into a feature module by using the feature create page at admin/build/features/create.
The features module also provides a way to manage features through a more targeted interface than admin/build/modules. The interface at admin/build/features shows you only feature modules, and will also inform you if any of their components have been overridden. If this is the case, you can also re-create features to bring the module code up to date with any changes that have occurred in the database.
Once you've exported your feature you will see that you have several files:
myfeature.info
myfeature.module
myfeature.[*].incYou can 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 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.
Because Features provides a centralized way to manage exportable components and write them to code it can be used during development in conjunction with a version control like SVN or git as a way to manage changes between development, staging and production sites. An example workflow for a developer using Features is to:
drush features-update.svn commit.svn update on the server. Other collaborating developers can also get her changes withsvn update.drush features-revert.Features also provides integration with the Diff module if enabled to show differences between configuration in the database and that in code. For site builders interested in using Features for development, enabling the diff module and reading API.txt for more details on the inner workings of Features is highly recommended.
Features provides several useful drush commands:
drush featuresdrush features-export [feature name] [component list]drush features-update [feature name]drush features-revert [feature name]drush features-diff [feature name]Additional commands and options can be found using drush help.
Features provides integration for the following exportables:
Features also provides faux-exportable functionality for the following Drupal
core and contrib components:
* Currently in development.
Please read API.txt for more information about the concepts and integration points in the Features module.
Features hatchlings by Saman Bemel Benrud.
README.txt For everyoneAPI.txt For developers, site buildersfeatures.api.php For developers