Devel Generate, which is part of the Devel module, makes it really simple to create dummy entities in Drupal. It'll create everything from users to taxonomy terms to nodes. It does a great job of populating most field types (including images). Sometimes it'd be nice to have more control over the output that it's generating. In particular, text fields often get populated with too much text.

The Devel Generate Text Settings module lets you control the length and format (sentence structure vs. title) of text and long text fields. It also lets you easily add a prefix to the title of the nodes being generated.

One problem you may have run into is for fields that need a limited amount of words or characters. Imagine you have a Father's Name field. Most of the time you'd expect to see two words (first name and last name). Devel Generate will almost certainly generate more than two words for this field. It may even generate 40! That's not desirable. We need the dummy content to appear as close to the real thing as possible.

Devel Generate Text Settings gives you the ability to tell Devel Generate to stay within a certain word count, or even hit an exact word count. It also allows you to set the "treat as title" value to true, which removes any punctuation from the generated text and capitalizes the first letter of each word.

Here is what the rule might look like for the field in this example:

field_father_name, word, 1, 2, true

The breakdown is: when generating content for the field_father_name field, generate either one or two words. Exclude punctuation and capitalize the first letter of each word.

After enabling you will find additional settings at the bottom of the "Devel Generate > Generate content" form.

There are detailed instructions with each field.

Note: this only works with nodes for now.

Project information

Releases