Demo content for distributions

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
Iztok's picture

Hi all,

what would you recommend using to provide demo content for a fairly simple distribution. I would liek to include files (images).

I have seen:

defaultcontent

Deprecated in favor of UUID, it does have the machine name, that you are throwing under nose to your users even if they don't need it.

UUID features

Demo content might not be the best use case, seem to be made for deployment not import.

Migrate

Used by commerce_kickstart got my attention. Maybe I am missing something or there is no easy way to export the date other than manually code the api hook.

Comments

I've dealt with this a lot in the past 6 months...

saltednut's picture

Panopoly uses defaultcontent. It works. Similarly, UUID Features Integration also works but I think its better at deploying config type nodes (D6) or things like Beans (D7). We use it in the Demo Framework for deploying Beans. node_export also does similar stuff for nodes only.

The thing I don't like about any of those solutions is that you're storing serialized entities inside your Features. This makes Features take a long time to enable and doesn't scale well at all.

Migrate is the best solution I've found. Once you get past the boilerplate and its a robust and easy solution thats very flexible. Yes you have to write code. Deal with it. :)

If you need Migration for Demo content examples, check out the Demo Framework codebase.
-- http://drupalcode.org/project/df.git/tree/HEAD:/modules/df/df_import

We provide a batch import for the demo content in DFS_WEM using migrations - this ensures that the Feature doesn't have to inject content and potentially time out on a slower server.
-- http://drupalcode.org/project/df.git/blob/HEAD:/modules/dfs/dfs_wem/dfs_...

I'm working on migrating

mrfelton's picture

I'm working on migrating Panopoly from UUID Features / Default Content (which works, but is outdated and buggy) to using Migrate as is done in Commerce Kickstart.

See Implement demo content via Migrate instead of defaultcontent.

This provides a far more robust, performant, and maintainable solution. Deleting the content can be done with a simple migrate rollback (which we do automatically when the app is disabled). As for exporting the content - this is something that I have not yet implemented, although it would not be hard to build your exports using Views. In Open Academy where we are also now using Migrate module, I'm considering including views to handle the exports along with each Apps _demo module.

--
Tom
www.systemseed.com - drupal development. drupal training. drupal support.