17
Features Everywhere! Feature Driven Development By Jay Callicott, Mediacurrent

Features everywhere

Embed Size (px)

DESCRIPTION

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

Citation preview

Page 1: Features everywhere

Features Everywhere!

Feature Driven Development

By Jay Callicott, Mediacurrent

Page 2: Features everywhere

Features Everywhere! Outline

About FeaturesThe ProblemThe SolutionHow to Create a FeatureFeature Driven Development

Page 3: Features everywhere

About Features

Who Uses Features?Created by DevelopmentSeed

Used extensively in OpenAtriumPhase2

Used extensively in OpenPublish

Recommended ReadingManaging and deploying configuration with exportables and the Features module - DrupalCon presentation by Jeff Miccolis of Development SeedMaking and Using Features in Drupal - Blog by Young Hahn of Development Seed

Page 4: Features everywhere

The Problem

Drupal has many items in the databaseViewsCCK Content typesImagecacheContextSettings

Moving these between environments is cumbersomeBacking these up is a painNo version controlDevelopers can accidentally override each other's work

Page 5: Features everywhere

The Solution - Features!Features' Benefits:

Work more in the ‘problem space’Encapsulation - Yes!Backup - Yes!Version Control - Yes!Easier deploymentCode reuse!A place for your form_alters and nodeapi() hooksDrush integration

And much, much more!Replace install profiles!

Features break an install into componentsCreate a distribution with drush .make

(music site, newspaper site, govt, blog, etc)

Page 6: Features everywhere

How To Create a Feature

Install and Enable the Following:FeaturesStrongarm (important)

Saves additional settings with your content types that would otherwise not get save

ContextRecommended over admin/build/block

Diff (recommended)Can view differences in code

Page 7: Features everywhere

How to Create a FeatureGo to /admin/build/features

(Sample screen)

Page 8: Features everywhere

How To Create a FeatureGo to /admin/build/features/create and add components

Page 9: Features everywhere

How to Create a FeatureClick download and save tar file to hard drive (this contains feature module files)

Page 10: Features everywhere

How to Create a FeatureExtract your feature folder to your project (screenshot showing 7zip on Windows 7)

Page 11: Features everywhere

How to Create a Feature

Add/commit to svn/git, svn up and enable on your Drupal site

Page 12: Features everywhere

How to Create a FeatureYour views, content types, etc will now be enabled, you have just deployed a feature!

Page 13: Features everywhere

How to Create a FeatureTo update use drush features-update + svn commit to update your features or 'recreate' for additions (new views, etc)

Page 14: Features everywhere

How to Create a FeatureRevert components if you a) updated a feature on another environment or b) want to restore a feature to it's original state

Page 15: Features everywhere

How to Create a FeatureAdd all your hooks to your .module file, e.g. form_alter(), nodeapi hooks, etc.

Page 16: Features everywhere

Feature Driven DevelopmentKill the customcontent module

Doesn't mean anythingIsn't modular

Create a 'Feature' for every feature on your Drupal siteMy methodology adapted from OpenAtrium, DevSeed, OpenPublish

Create a feature for every content typePackage with any related viewsPackage relevant imagecache presetsSometimes directly related permissionsI package all context in it's own feature, but some package related context in each featurePlace all related form_alters, nodeapi hooks, hook_menus(), etc in the .module file

That's it!

Page 17: Features everywhere

The End

More Links/Resources:Features Project PageDevelopmentSeed Blog for updated information on FeaturesAutomating Drupal deployment with Drush and Features - Drupalcamp Austin Presentation by Adam Jensen and Adrian Rollett | UNT.edu