A Quick overview on Drupal features modules

By

January 16, 2012Code Drupal FrameworkNo comments

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 . The component  that can be exported by drupal are as follows,

  1. Content type
  2. CCK
  3. Views
  4. Taxonomy
  5. Menus
  6. User Roles
  7. Permissions
  8. 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.

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:

List all the available features on your site and their status.

  1. drush features-export [feature name] [component list] – Write a new feature in code containing the components listed.
  2.   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).
  3. 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.
  4. 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

Leave a Reply