1

I love the Devel Generate module as it helps me to create test content very quickly. Random content that the module generates is sufficient most of the times.

But at times I would like to have content for all the permutations and combinations. For example let us say that a content type has three optional fields. So in total I would like to have 8 nodes of that type created that cover all the permutations.

Is this something that can be achieved with the Devel module?

3
+50

To my knowledge there is no such feature in the Devel Generate module.

Therefor, as an alternative, I recommend to use a (rather basic) custom module for creating such nodes (so without using Devel Generate).

The article about How to programmatically create nodes, comments and taxonomies in Drupal 7 contains great example of how to do so. Here is a summary of that article (about how to programmatically create a node):

  • Initialize a node object
  • Add body field
  • Add custom fields
  • Add file / image field
  • Add a term to a node
  • Save a node

You probably don't need the "add file" and "add term", and simply have to repeat the "add custom fields" a few times (for each of your 3 fields), and then "you" are in full control of which permutations/combinations you actually want.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.