Features everywhere

1,785 views
1,668 views

Published on

Drupal feature-driven development. Creating resuable code using the 'Features' module.

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,785
On SlideShare
0
From Embeds
0
Number of Embeds
223
Actions
Shares
0
Downloads
27
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Features everywhere

  1. 1. Features Everywhere! Feature Driven Development By Jay Callicott, Mediacurrent
  2. 2. Features Everywhere! Outline About Features The Problem The Solution How to Create a Feature Feature Driven Development
  3. 3. About Features Who Uses Features? Created by DevelopmentSeed Used extensively in OpenAtrium Phase2 Used extensively in OpenPublish Recommended Reading Managing and deploying configuration with exportables and the Features module - DrupalCon presentation by Jeff Miccolis of Development Seed Making and Using Features in Drupal - Blog by Young Hahn of Development Seed
  4. 4. The Problem Drupal has many items in the database Views CCK Content types Imagecache Context Settings Moving these between environments is cumbersome Backing these up is a pain No version control Developers can accidentally override each other's work
  5. 5. The Solution - Features! Features' Benefits: Work more in the ‘problem space’ Encapsulation - Yes! Backup - Yes! Version Control - Yes! Easier deployment Code reuse! A place for your form_alters and nodeapi() hooks Drush integration And much, much more! Replace install profiles! Features break an install into components Create a distribution with drush .make (music site, newspaper site, govt, blog, etc)
  6. 6. How To Create a Feature Install and Enable the Following: Features Strongarm (important) Saves additional settings with your content types that would otherwise not get save Context Recommended over admin/build/block Diff (recommended) Can view differences in code
  7. 7. How to Create a Feature Go to /admin/build/features (Sample screen)
  8. 8. How To Create a Feature Go to /admin/build/features/create and add components
  9. 9. How to Create a Feature Click download and save tar file to hard drive (this contains feature module files)
  10. 10. How to Create a Feature Extract your feature folder to your project (screenshot showing 7zip on Windows 7)
  11. 11. How to Create a Feature Add/commit to svn/git, svn up and enable on your Drupal site
  12. 12. How to Create a Feature Your views, content types, etc will now be enabled, you have just deployed a feature!
  13. 13. How to Create a Feature To update use drush features-update + svn commit to update your features or 'recreate' for additions (new views, etc)
  14. 14. How to Create a Feature Revert components if you a) updated a feature on another environment or b) want to restore a feature to it's original state
  15. 15. How to Create a Feature Add all your hooks to your .module file, e.g. form_alter(), nodeapi hooks, etc.
  16. 16. Feature Driven Development Kill the customcontent module Doesn't mean anything Isn't modular Create a 'Feature' for every feature on your Drupal site My methodology adapted from OpenAtrium, DevSeed, OpenPublish Create a feature for every content type Package with any related views Package relevant imagecache presets Sometimes directly related permissions I package all context in it's own feature, but some package related context in each feature Place all related form_alters, nodeapi hooks, hook_menus(), etc in the .module file That's it!
  17. 17. The End More Links/Resources: Features Project Page DevelopmentSeed Blog for updated information on Features Automating Drupal deployment with Drush and Features - Drupalcamp Austin Presentation by Adam Jensen and Adrian Rollett | UNT.edu

×