Dev / Drupal

Creating a Drupal Site with Dummy Content for Your Development

Creating dummy content for your development is a MASSIVE WASTE OF TIME. I used to manually create the content and Lorem Ipsum my way into a semi-populated site. Now depending on your site this could take minutes or HOURS.

Now wouldn’t you rather spend that time configuring and developing your site? I know I would.

The following modules in combination can help with that.

Devel

https://drupal.org/project/devel

Devel module has several nifty features we can use but for creating dummy content this is the key. It comes with Devel Generate which can generate dummy content for nodes, taxonomies, taxonomy terms, users, even menus!

A suite of modules containing fun for module developers and themers …

You can also specify to delete existing content if you wish. I use this feature sometimes to delete trash content.

The nice thing about Devel Generate is that it works well with fields. It can even pre-populate image fields.

I suggest you try it out to find out what it can do.

Demonstration Site

Demo

https://drupal.org/project/demo

This module is used to create snapshots of your site so you can reset it back at a later date.

This module allows you to take snapshots of your site. It turns a Drupal installation into a sandbox that you can use to:

Try out and test new modules, configuration, etc.
Set up a public demonstration site for a contributed module or theme.
Develop and test update and upgrade paths.
Whenever you need to reset your site to the state of a saved snapshot a click of your mouse will do so.

Why did I include this? because I use it before and after creating tons of dummy content. It’s pretty handy.

You can quickly populate your site or decimate the whole thing in one go. Then you can rollback to the bare site if you want – all this without going into terminal, mysql, or phpmyadmin.

It actually generates an sql file containing your site’s database so you can actually re-use it in another installation of Drupal if you want.

Another neat feature is that you can actually restore your site in a regular interval via cron.

WARNING: Before you use this module continue reading below.

Features

https://drupal.org/project/features

Now the problem with restoring your database is that you absolutely decimate all your settings – this includes views, block settings, content, menus, etc. It’s a nightmare to see hours and hours of work gone.

So before you reset your site, pack your settings, content types, views etc. into features.

The features module enables the capture and management of features in Drupal. A feature is a collection of Drupal entities which taken together satisfy a certain use-case.

Features is a pretty advanced module so my advice is to play around with it to get the hang of it. Then you can use Features to pack your settings.

3 Modules? My mind is overloading! How do I use them?

To give you the bullet points of what to do:

  1. Make a snapshot of your site via Demo Site. This is the start point.
  2. Configure your content types, taxonomies, roles, etc.
  3. Generate content via Devel Generate for which content you need.
  4. Check if everything’s ok with your site.
  5. Make a second snapshot. This is pre-dev.
  6. Do magic. Tweak your site, set it up, etc.
  7. Once configured, make a third snapshot. This is your full dummy content snapshot.
  8. Package your features.
  9. You can reset your site then test out if the features work. If not you can reset back to the full dummy snapshot.

Isn’t this achievable with other tools?

Yes of course. You can do the backup and restore process with Backup and Migrate, you can manually generate content yourself, and you can package your code by making copies.

This method makes it achievable by just using the UI of Drupal.

Of course this method is only 1 way. If it fits, use it. If not, that’s OK too.

 

Resources:

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s