Dummy Content (DC) provides an API (hooks) for other modules to generate (& manage) dummy nodes.

DC allow your custom module to provide demo nodes as soon as the module is installed - this helps with populating blocks, views, and generally showcasing your module's functionality. This is very useful when showcasing a module's functionality to a client. For example, rather than installing the Forum module and having to manually create forum nodes, the DC API can be used to pre-populate the site with forum-type nodes as soon as the Forum module is enabled. Additionally, rather than having purely Lorem Ipsum-type content, you can define relevant pieces of text and images, giving the content a more complete & realistic look & feel.

DC will also clean up after itself, removing any dummy nodes when child-modules are disabled.

Requirements

As of 7.x-1.2, DC requires the Tableform module.

API

The included dc_example.module provides an example implementation of the available hooks:

hook_dummy_content_data():
- allows you to define 'subjects' of text and image data

hook_dummy_content():
- allows you to specify how many nodes of what type should be created, what 'subject' of content should be used (defined in the hook above), and what fields should be populated

hook_dummy_content_settings
- allows you to control whether or not dummy content should be enabled/disabled when the module is enabled/disabled (useful if you want the user to manually generate dummy content through the UI)

Supported field types

textfield & textarea: Random amount of text is entered from the specified subject; defaults to Lorem Ipsum if no text subject defined.

select: Random option(s) is/are chosen.

checkbox: Random options are chosen.

radios: Random option is chosen.

image & media: Random image(s) are chosen; images must be defined via hook_dummy_content_data().

file: A random text file is generated and attached.

taxonomy: Random option(s) is/are chosen if presented as a select, otherwise random text is generated and term created.

date: A random date in the next 30 days is chosen.

dc_example.module notes

Field quantities can be specified as a set number (integer), an "unlimited" (-1) value (will result in a random number being chosen between 1 and 5), or a manual "random range" specified via an array; see dc_example.module, field_tags field.

Note that the image paths specified within dc_example.module do not actually contain any images (due to licensing issues). If you want the example module to attach images to image fields, you'll need to add some images to the dc_example module. Have a look at the example code and paths will be obvious.

Sponsorship

Module development sponsored by ImageX Media.

Project information

Releases