Client Area

Do Drupal Right

Jay Callicott's picture
Jay Callicott  | Product Manager, Lead Architect
Aug
17
2010

As a Drupal developer, I am constantly trying to streamline and generally make my processes as efficient as possible. With that said, I have seen tremendous value incorporating Features in just about everything that I do Drupal-related. Recently, I shared a snapshot at a Mediacurrent staff meeting of a more in-depth presentation I would like to do at the upcoming Drupalcamp Atlanta. Basically, I go over the highlights of Features with a short 'how-to' tutorial and then some notes on the general methodology I use when setting up a site. Again, I have gotten into the habit of using Features quite extensively (you could say Everywhere) on my projects so I thought I would share my approach. Oh yeah, please vote for the session or share any feedback on what I can do to enhance the presentation. I would greatly appreciate it.

Features everywhere - Webinar Transcript
  1. Features Everywhere!
    • Feature Driven Development By Jay Callicott, Mediacurrent
  2. Features Everywhere! Outline
    • About Features
    • The Problem
    • The Solution
    • How to Create a Feature
    • Feature Driven Development
  3. About Features
  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. 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. How To Create a Feature
  7. 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
  8. How to Create a Feature
    • Go to /admin/build/features (Sample screen)
  9. How To Create a Feature
    • Go to /admin/build/features/create and add components
  10. How to Create a Feature
    • Click download and save tar file to hard drive (this contains feature module files)
  11. How to Create a Feature
    • Extract your feature folder to your project (screenshot showing 7zip on Windows 7)
  12. How to Create a Feature
    • Add/commit to svn/git, svn up and enable on your Drupal site
  13. How to Create a Feature
    • Your views, content types, etc will now be enabled, you have just deployed a feature!
  14. How to Create a Feature
    • To update use drush features-update + svn commit to update your features or 'recreate' for additions (new views, etc)
  15. 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
  16. How to Create a Feature
    • Add all your hooks to your .module file, e.g. form_alter(), nodeapi hooks, etc.
  17. 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!
  18. The End

 

Share This Post