Tuesday 5: Florian Lorétan, "10 Reasons why you should be using features for your Drupal project"

A lot of blogposts talking about features recently. It's a wave.

We forget about how good CCK is with its drag and drop
We also forget how hard Views is to understand, but how good it is when you get it
When we show our developers features, they know how problematic config in the database is.

What are features?

They're little cute monsters which come out of eggs. Er, no.

1. Features puts configuration into code

What can be exported: exportables

views
imagecache presets
ctools panels
ctools open layers
rules
blocks (via context)
variables (via strongarm)

Feature versioning

Start with default feature in the code (like default views)
But tweak features - these tweaks are in the database. Feature will be marked as overridden

Non-exportables: features gives you an API

Content types
Roles
Permissions
Menus
Vocabularies
... Nodes, terms and users using UUIDs... experimental

These need to always be in the database, because there's no core API to declare it as e.g. a default content type in the same way as you can declare a default view.

What can't be exported

Input formats
Things that can only be identified using sequential numeric IDs (menu items)

2. Features lets you organize your project

Massive number of permissions
Modules
Views

Allows you to bundle N modules, M views and X permissions into one feature bundle. Features can have dependencies

Feature which is job listing plus job content type

3. Features is integrated with drush

drush features-*

4. Features can be version-controlled

5. Features mean you can work with other people

Features package up config

Feature gets shared; changes work; features get put back into the central repository; second dev gets a newer code version than her database - features puts the feature up for review.

6. Features make deployment easier

7. Features helps Drupal major version migration

We would want to separate out functionality and content

[this is never as easy as it looks, anyway! to the client, it's all HTML]

But a big problem is that there's actually a separation of filesystem and database, with some in one and some in the other.

8. Features let you build Drupal products

9. Tracking changes your clients make

When you let your clients change things, they break.

But now, when they change things, they override the feature. You can always drop back.

[Have to invest time in ensuring all our own live-site config is checked in as a feature]

10. Features is the best way to put config into code

It's also used by a LOT of people.