Building and Maintaining a Distribution in Drupal 7 with Features
Drupal features knowledge sharing
-
Upload
brahampal-singh -
Category
Technology
-
view
60 -
download
0
Transcript of Drupal features knowledge sharing
Drupal “Features” moduleSupport to export/import Drupal components like Views, menus, menu items, content types, CCK fields, image cache presets, Drupal variables, permission, user roles etc.
Braham Pal Singh| Jan 19, 2015
1. What’s the “Features” module?2. How to use “Features”?3. Features file structure4. Features state like default, overridden, need
review5. “Revert” feature components6. Supported modules7. Using “Drush” for features8. References
Agenda
Features provides a UI and API for taking different site building components from modules with exportable 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.
What’s the “Features” module?
Download and install “features” module form Drupal community
Create the feature and download it. Put this feature in destination site and
install it like a module Review all the components
How to use “Features”?
Default (state): All settings in your feature identically match their respective settings on the site.
Overridden (state): The components of the feature used in the site no longer match the state of them in the feature module.
Needs review (state): This is effectively the same state as overridden, but generally means there are more complicated changes and it's recommended you review the differences prior to reverting the feature.
States - default, overridden, need review
“Revert” feature components
Revert (action): You can revert an overridden feature to make the site settings match those in your feature module.
Update/Recreate (action): Updating a feature is the exact opposite of reverting one, instead of reverting your site to match your feature, you'll update your feature to match your site.
Sample code:/*** Release : FRv1.2* Revert the panel to change “Baisse des prix” name to "Garanties prix bas"*/function fr_feature_catalogues_et_bons_plans_update_7002() { features_revert(array('fr_feature_catalogues_et_bons_plans' => array(‘node‘,’ views_view’ )));}
Supported modules
Features Override Strongarm - export system Variables FTools - misc tools for Features (most functionality incorporated into Features 7.x-2.x) Features Plumber (not needed with Features 7.x-2.x) Features Extra
References
https://www.drupal.org/node/580052 http://mustardseedmedia.com/podcast/episode43 https://
drupalize.me/videos/introduction-drupal-features-module?p=1170
http://drupalcontrib.org/api/drupal/contributions%21features%21features.module/function/features_revert/7