You are hereBlogs / Jeff Schuler's blog / A Paradigm for Reusable Drupal Features (DrupalCon 2009 notes)

A Paradigm for Reusable Drupal Features (DrupalCon 2009 notes)


Posted by Jeff Schuler - on 05 March 2009

A Paradigm for Reusable Drupal Features
Young Hahn, Robert Soden, Ian Ward (DevelopmentSeed)

  1. In theory: the problem + solution
  2. In practice: feature building demo
  3. The future: what comes next

A blog is a "feature". So is a pressroom, an image gallery, a publication library, etc., etc. Blog can be created using core module, or cusotm recreated.

Example: making a pressroom: content types, fields, views, etc.

3 problems: slow, not reusable, disconnected pieces

A (turnkey)feature module: takes everything usually done in UI and puts it into code. How?

  • Scripted: content type, fields, taxonomy, menus
  • Exported: imagecache presets, block visibility, block views, page views, comp. relations

Spaces + Context demo

Code:

  • is reusable
  • is distributable
  • can be kept under version control

Getting site-building into code:

Scripts:

  • pain to debug
  • pain to maintain
  • not easily extensible

Earl Miles' Chaos tool suite

Exportables:

  • abstract data storage so that your module can be indifferent to whether it's in code or db
  • provide definitions, not scripts
  • are easy to maintain
  • are overridable and extensible

Modules with exportables?

  • views
  • panels
  • context_ui
  • imagecache

Recipe for exportables

  • string identifiers
  • API functions for collecting all items
  • Structured array or object to represent your item

Future: ability to export features into module form

Developers: move toward adding exportability into your module!