Jul 16, 2011

Features Module Drupal

IMO Absolutely this module should be named as one of the core module in Drupal, This is the feature that we all (Drupal developers) were expecting when we were struggling to get the site 'live' from 'staging' or 'staging' from'development'. So here the most anticipated feature of Drupal developers.

What the module does ?
In a nutshell this module allows you to Import and Export Content types,Views,CCK Fields, Permissions, Roles, Menus etc... from one drupal site to another.

Step by step instructions
  • Download the module from : http://drupal.org/project/feature
  • Upload, Enable it in /admin/build/modules
  • After you enable the module you could see the 'Fetures' tab in 'Site Building ' menu or you can directly redirect to  /admin/build/features
  • Once you click on that tab or go to the admin/build/features link you might get into the features configurations page with two tabs 
    1. Manage
    2. Create feature
  • Click on 'Create feature'
    • Note : all the features that your going to create is going to be a separate module/ will export a different module.(you can get a clear picture of what I mean in the end of this chapter)
    •  In the 'Name' field give an appropriate name for your feature.
    • Then a 'Description'
    • Then the 'Version' such as 6.x-1.0,  6.x-1.0-beta1
    • (This is the normal structure of a module you write in the .info file See module development ) 
    • Leave the "URL of update XML" field for now 
    • In the "Edit components" dropdown list, select the component that you want to export             eg: Views
    • Once 'Views' is selected it will give you a  list of the views that you've created in /admin/build/views
    • Select the view you want to export (you can select multiple views)
    • If all set, then hit the 'Download feature' button and export your view(it will download as a zipped/tar/rar file as you download a module)
    • Now your done with exporting your view.
    • Note 2: Hope you understood why I said 'its a module' in the previous note
  •  Yipppi!!! we exported our view, and next is to import it to the other Drupal site where we need the same view.
    • Go to the other site and make sure the 'Features' module is Installed and enabled
    • Now untar the feature you downloaded and then upload it to your /sites/all/modules/ folder via FTP
    • Then click the 'Features' configuration page in the 'Site Building' menu or go to admin/build/features 
    • Click on 'Manage' 
    • You'll find the feature that you uploaded in the manage page. 
    • Simply check the chekcbox and enable the feature.
    • Hurrraaaay!!! the component you exported would be available for in your new site too
      • eg: If you have exported a view and uploaded in the other site, the view would have been created in your site by enabling it, you can still check it in /admin/build/views .
  • Enjoy Features module cheers :)