Drupal features module overview
Drupal features module provides the UI and API for exporting the various component used in drupal like content type, Views etc. In this post we are going to see the key features.
Components that can be exported by drupal are as follows,
- Content type
- CCK
- Views
- Taxonomy
- Menus
- User Roles
- Permissions
- Image Styles
The basic usage of the feature module.
1) Export the features
After enabling the features module , you can export the new feature in admin/structure/features/create in this page enter the name of the feature , description and the version information and from the ” Edit components ” combo box select the component to be exported as feature and click “Download features” . the exported features contains the files same as of module directory.
1 2 3 4 5 |
myfeatures.info myfeatures.[*].inc myfeatures.module |
You can extent the features by using the custom code in the myfeatures.module file by using the drupal hooks and custom function.
The exported drupal feature can be used in the various drupal instances or project, so the content types , CCK, taxonomy, views etc.. used in one instance or project can be re-used for the various drupal projects.
2) Manage Features
The feature module also allows the way to manage the features by the admin/structure/features in drupal 7 , In the mange feature interface you can “Re-Create” the feature and override the components up to date.
3) Drush usage in features
Features provides several useful drush commands:
1 |
drush features |
List all the available features on your site and their status.
- drush features-export [feature name] [component list] – Write a new feature in code containing the components listed.
- drush features-update [feature name] – Update the code of an existing feature to include any overrides/changes in your database (e.g. a new view).
- drush features-revert [feature name] – Revert the components of a feature in your site’s database to the state described in your feature module’s defaults.
- drush features-diff [feature name] – Show a diff between a feature’s database components and those in code. Requires the Diff module.
Requirement: Drupal Features Module
Download: http://drupal.org/project/features
0 Comments Leave a comment