Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Drupal Presentation for CapitalCamp 2011: Features Driven Development


Published on

Mediacurrent's Jay Callicott reviews and analyzes how to leverage Features within Drupal at CapitalCamp 2011 in Washington D.C.

Published in: Technology
  • Be the first to comment

Drupal Presentation for CapitalCamp 2011: Features Driven Development

  1. 1. Features Everywhere! Feature Driven DevelopmentBy Jay CallicottMediacurrent ConsultantCapitalCamp 2011July 22, 2011
  2. 2. Features Everywhere! Outline• Part I - The Basics o About Features o About Jay o The Problem o The Solution o How to Create a Basic Feature• Part 2 - Diving Deeper o Context & Features o Panels & Features o Adding stuff that isnt exportable o Feature Driven Development o Real World Examples!
  3. 3. About Features• 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• Who Uses Features? o Originally created by DevelopmentSeed  Used extensively in OpenAtrium o Phase2  Used extensively in OpenPublish  Now maintained by Phase2
  4. 4. About FeaturesOpenAtrium
  5. 5. About Features
  6. 6. About Jay• Mediacurrent Web Developer• Developed Drupal sites since version 4.6• Why Features? o Started using features in early 2010 o Developed features extensively on a large OpenPublish- based multi-site installation, working with Phase2 o Now use features on every site big and small• OpenChurch distribution maintainer o Features used extensively
  7. 7. The Problem• Drupal has many items in the database o Views o CCK Content types o Imagecache o Context o Panels o Settings o Permissions• Moving these between environments is cumbersome• Backing these up is a pain• No version control• Developers can accidentally override each others work
  8. 8. The Solution - Features!• Features Benefits: o Work more in the „problem space‟ o Encapsulation - Yes! o Backup - Yes! o Version Control - Yes! o Easier deployment o Code reuse! o A place for your form_alters and nodeapi() hooks o Drush integration• And much, much more! o Replace (or supplement) install profiles!  Features break an install into components o Create a distribution with drush .make  (music site, newspaper site, govt, blog, etc)
  9. 9. How to Create a Feature• Install and Enable the Following: o Features o Strongarm (important)  Saves additional settings with your content types that would otherwise not get save o Context  Recommended over admin/build/block o Diff (recommended, only on non-production environments)  Can view differences in code
  10. 10. How to Create a FeatureGo to /admin/build/features (Sample screen)
  11. 11. How to Create a FeatureGo to /admin/build/features/create and add components
  12. 12. How to Create a FeatureClick download and save tar file to hard drive (this containsfeature module files)
  13. 13. How to Create a FeatureExtract your feature folder to your project (screenshot showing7zip on Windows 7)
  14. 14. How to Create a FeatureAdd/commit to svn/git, svn up and enable on your Drupal site
  15. 15. How to Create a FeatureYour views, content types, etc will now be enabled, you havejust deployed a feature!
  16. 16. How to Create a FeatureTo update use drush features-update + svn commit to updateyour features or recreate for additions (new views, etc)
  17. 17. How to Create a FeatureRevert components if you a) updated a feature on anotherenvironment or b) want to restore a feature to its original state
  18. 18. Context & Features•• Context is used primarily for block placement (admin/build/block replacement)• Exports to features out of the box Screenshots next....
  19. 19. Context Example Screenshot
  20. 20. Adding Context to a Feature
  21. 21. Panels & Features• Panels export to features easily o Falls under Panels or Page Manager in dropdown in components• I like panels for node layouts! o (overriding page manager node template) Screenshots next....
  22. 22. Panels Feature Examplecontextplacedblocks panel regions & views
  23. 23. Panels Feature Underneath...
  24. 24. Panel Feature UnderneathUsing CCK, views, panel, strongarm
  25. 25. Adding a Panel to a Feature under "Panels" or "Page Manager"
  26. 26. How to export non-exportables• Features doesnt export everything, but its still a module!• Next: simple example, creating a vocabulary with a feature o (Note: features_extra does this for you)
  27. 27. How to export non-exportables Using hook_install() & hook_uninstall()• Anything you can do in a module you can do in a feature
  28. 28. Feature Driven Development• My methodology (adapted from OpenAtrium, DevSeed, OpenPublish) o Create a feature for every content type o Package with any related views o Package panels and node template overrides! o Package relevant imagecache presets o Sometimes directly related permissions o Sometimes package related contexts o Place all related form_alters, nodeapi hooks, hook_menus(), etc in the .module file• Thats it!
  29. 29. Real World Examples!• Seeing is believing, some (more) real world screenshots of feature lists
  30. 30. Real World List Screenshots
  31. 31. Real World List Screenshots
  32. 32. Real World List Screenshots
  33. 33. Real World ScreenshotsThe trend is I alwayshave at least 1feature for eachcontent type
  34. 34. Wait! A couple last items to cover• Features Extra• Drush Make• Distributions with .make• Features Server• Share Features!• Drupal “Apps”(introduced by Ph2)• What about Drupal 7?• Im a beginner – is this for me?
  35. 35. The EndResources• Features Project Page o• Features Extra Project Page o• From Zero to Distribution using Features, Profiler, and Drush Make o distribution-using-features-profiler-and-drush-makeHit me up on twitter: